From 74da1728c62c3b4402a996c58187b449905e0488 Mon Sep 17 00:00:00 2001 From: Eric Duong Date: Thu, 2 Nov 2023 22:06:26 -0400 Subject: [PATCH] chore(data-warehouse): Split team by workspace (#18313) * create airbyte source api * comment test * rename and add connection * comment out test * frontend updates and additional API calls on airbyte * some more UI and retrieve endpoint * restore lock file * connecting the dots * add destination logic * make destinatino parquet * ui updates * rename data * more renaming * migration * remove test * rename * Update UI snapshots for `chromium` (2) * missing file * typing * remove unneeded field * add rollback deletions if one fo the related resources fails * add feature flag * fix error handling * adjust warning messages * fix external link listener * Update UI snapshots for `chromium` (2) * format * add model * add api call * remove unnecessary env var * remove env var * adjustments * add more env vars * update vars * fix import * wrong migration name * add cleanup * working workspaces * simplify workspace id storage * Update query snapshots * logging * Update query snapshots * Update query snapshots * Update query snapshots * Update query snapshots --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- latest_migrations.manifest | 2 +- .../api/test/__snapshots__/test_action.ambr | 9 +- .../test/__snapshots__/test_annotation.ambr | 9 +- .../api/test/__snapshots__/test_decide.ambr | 12 +- .../test_early_access_feature.ambr | 6 +- .../api/test/__snapshots__/test_element.ambr | 3 +- .../api/test/__snapshots__/test_insight.ambr | 27 ++- .../test/__snapshots__/test_preflight.ambr | 3 +- .../api/test/__snapshots__/test_survey.ambr | 3 +- .../__snapshots__/test_dashboard.ambr | 181 ++++++++++++------ .../__snapshots__/test_notebook.ambr | 19 +- .../0359_team_external_data_workspace_id.py | 17 ++ .../test/__snapshots__/test_filter.ambr | 15 +- posthog/models/team/team.py | 1 + .../test_session_recordings.ambr | 63 ++++-- posthog/settings/airbyte.py | 3 +- .../test/__snapshots__/test_feature_flag.ambr | 3 +- posthog/warehouse/api/external_data_source.py | 7 +- .../warehouse/external_data_source/client.py | 28 +++ .../external_data_source/connection.py | 73 +++---- .../external_data_source/destination.py | 29 +-- .../warehouse/external_data_source/source.py | 39 +--- .../external_data_source/workspace.py | 22 +++ posthog/warehouse/sync_resource.py | 2 +- 24 files changed, 356 insertions(+), 220 deletions(-) create mode 100644 posthog/migrations/0359_team_external_data_workspace_id.py create mode 100644 posthog/warehouse/external_data_source/client.py create mode 100644 posthog/warehouse/external_data_source/workspace.py diff --git a/latest_migrations.manifest b/latest_migrations.manifest index a5b2111866ab5..5d996c9f43b48 100644 --- a/latest_migrations.manifest +++ b/latest_migrations.manifest @@ -5,7 +5,7 @@ contenttypes: 0002_remove_content_type_name ee: 0015_add_verified_properties otp_static: 0002_throttling otp_totp: 0002_auto_20190420_0723 -posthog: 0358_externaldatasource +posthog: 0359_team_external_data_workspace_id sessions: 0001_initial social_django: 0010_uid_db_index two_factor: 0007_auto_20201201_1019 diff --git a/posthog/api/test/__snapshots__/test_action.ambr b/posthog/api/test/__snapshots__/test_action.ambr index 6564d9398a50b..9e5a6e27bc131 100644 --- a/posthog/api/test/__snapshots__/test_action.ambr +++ b/posthog/api/test/__snapshots__/test_action.ambr @@ -69,7 +69,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_actions-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/actions/%3F%24'*/ @@ -222,7 +223,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_actions-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/actions/%3F%24'*/ @@ -546,7 +548,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_actions-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/actions/%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_annotation.ambr b/posthog/api/test/__snapshots__/test_annotation.ambr index 762469eaa98ff..c65e6d87b6b8b 100644 --- a/posthog/api/test/__snapshots__/test_annotation.ambr +++ b/posthog/api/test/__snapshots__/test_annotation.ambr @@ -69,7 +69,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_annotations-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/annotations/%3F%24'*/ @@ -146,7 +147,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_annotations-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/annotations/%3F%24'*/ @@ -468,7 +470,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_annotations-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/annotations/%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_decide.ambr b/posthog/api/test/__snapshots__/test_decide.ambr index 119d2cf9bbcd0..6dfc0f0b88fea 100644 --- a/posthog/api/test/__snapshots__/test_decide.ambr +++ b/posthog/api/test/__snapshots__/test_decide.ambr @@ -76,7 +76,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='team-detail',route='api/projects/%28%3FP%3Cid%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -315,7 +316,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -468,7 +470,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -609,7 +612,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."api_token" = 'token123' LIMIT 21 diff --git a/posthog/api/test/__snapshots__/test_early_access_feature.ambr b/posthog/api/test/__snapshots__/test_early_access_feature.ambr index 1b4cf700cdf05..d3c93b8cb12b0 100644 --- a/posthog/api/test/__snapshots__/test_early_access_feature.ambr +++ b/posthog/api/test/__snapshots__/test_early_access_feature.ambr @@ -47,7 +47,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -170,7 +171,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."api_token" = 'token123' LIMIT 21 /*controller='posthog.api.early_access_feature.early_access_features',route='%5Eapi/early_access_features/%3F%28%3F%3A%5B%3F%23%5D.%2A%29%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_element.ambr b/posthog/api/test/__snapshots__/test_element.ambr index 4ac868d1be860..86c2be653ea04 100644 --- a/posthog/api/test/__snapshots__/test_element.ambr +++ b/posthog/api/test/__snapshots__/test_element.ambr @@ -76,7 +76,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='element-stats',route='api/element/stats/%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_insight.ambr b/posthog/api/test/__snapshots__/test_insight.ambr index f8f92a910dfd8..9282a318a860e 100644 --- a/posthog/api/test/__snapshots__/test_insight.ambr +++ b/posthog/api/test/__snapshots__/test_insight.ambr @@ -667,7 +667,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -715,7 +716,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -846,7 +848,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1067,7 +1070,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1215,6 +1219,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -1340,6 +1345,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -1446,6 +1452,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -1579,7 +1586,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1669,7 +1677,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1751,7 +1760,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1806,7 +1816,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_preflight.ambr b/posthog/api/test/__snapshots__/test_preflight.ambr index 93baa4d92d31e..5444d9952e971 100644 --- a/posthog/api/test/__snapshots__/test_preflight.ambr +++ b/posthog/api/test/__snapshots__/test_preflight.ambr @@ -87,7 +87,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='posthog.views.preflight_check',route='%5E_preflight/%3F%28%3F%3A%5B%3F%23%5D.%2A%29%3F%24'*/ diff --git a/posthog/api/test/__snapshots__/test_survey.ambr b/posthog/api/test/__snapshots__/test_survey.ambr index 7e4be97199109..d813d92edcb81 100644 --- a/posthog/api/test/__snapshots__/test_survey.ambr +++ b/posthog/api/test/__snapshots__/test_survey.ambr @@ -148,7 +148,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."api_token" = 'token123' LIMIT 21 /*controller='posthog.api.survey.surveys',route='%5Eapi/surveys/%3F%28%3F%3A%5B%3F%23%5D.%2A%29%3F%24'*/ diff --git a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr index b6b14a9dfbd34..f40bb246f4ce1 100644 --- a/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr +++ b/posthog/api/test/dashboards/__snapshots__/test_dashboard.ambr @@ -69,7 +69,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -192,7 +193,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -318,6 +320,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -527,6 +530,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -691,6 +695,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -867,6 +872,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -1029,6 +1035,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -1265,7 +1272,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1320,7 +1328,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1466,7 +1475,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1581,7 +1591,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1636,7 +1647,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1780,7 +1792,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -1911,7 +1924,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -2162,7 +2176,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -2400,7 +2415,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -2534,6 +2550,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -2651,7 +2668,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -2761,7 +2779,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -2865,7 +2884,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -3013,7 +3033,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -3108,6 +3129,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -3228,7 +3250,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -3342,7 +3365,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -3481,7 +3505,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -3792,7 +3817,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -3948,7 +3974,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -4080,7 +4107,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -4170,7 +4198,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -4329,7 +4358,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -4384,7 +4414,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -4498,7 +4529,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -4653,7 +4685,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5069,7 +5102,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5208,7 +5242,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5298,7 +5333,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5419,7 +5455,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -5501,7 +5538,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5556,7 +5594,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5670,7 +5709,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5815,7 +5855,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -5976,6 +6017,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -6373,7 +6415,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -6528,6 +6571,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -6707,6 +6751,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -6871,6 +6916,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -7000,7 +7046,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -7095,6 +7142,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -7257,6 +7305,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -7887,7 +7936,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8153,7 +8203,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8312,7 +8363,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8367,7 +8419,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8481,7 +8534,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8636,7 +8690,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8757,7 +8812,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -8883,7 +8939,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -9028,7 +9085,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -9335,7 +9393,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -9480,7 +9539,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -9582,7 +9642,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_insights-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/insights/%3F%24'*/ @@ -9717,6 +9778,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -9833,7 +9895,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -9970,6 +10033,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -10149,6 +10213,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -10296,7 +10361,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -10405,6 +10471,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -10555,7 +10622,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -10738,7 +10806,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -10847,6 +10916,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -10997,7 +11067,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ @@ -11142,6 +11213,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_organization"."id", "posthog_organization"."name", "posthog_organization"."slug", @@ -11367,7 +11439,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_dashboards-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/dashboards/%3F%24'*/ diff --git a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr index 993103ccbf72e..f7ed1cc0e4c76 100644 --- a/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr +++ b/posthog/api/test/notebooks/__snapshots__/test_notebook.ambr @@ -69,7 +69,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_notebooks-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/notebooks/%3F%24'*/ @@ -164,7 +165,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_notebooks-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/notebooks/%28%3FP%3Cshort_id%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -219,7 +221,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_notebooks-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/notebooks/%28%3FP%3Cshort_id%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -326,7 +329,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_notebooks-all-activity',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/notebooks/activity/%3F%24'*/ @@ -536,7 +540,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_notebooks-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/notebooks/%28%3FP%3Cshort_id%3E%5B%5E/.%5D%2B%29/%3F%24'*/ @@ -645,6 +650,7 @@ "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id", "posthog_user"."id", "posthog_user"."password", "posthog_user"."last_login", @@ -749,7 +755,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_notebooks-detail',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/notebooks/%28%3FP%3Cshort_id%3E%5B%5E/.%5D%2B%29/%3F%24'*/ diff --git a/posthog/migrations/0359_team_external_data_workspace_id.py b/posthog/migrations/0359_team_external_data_workspace_id.py new file mode 100644 index 0000000000000..279fa2f84d450 --- /dev/null +++ b/posthog/migrations/0359_team_external_data_workspace_id.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.19 on 2023-11-02 20:22 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("posthog", "0358_externaldatasource"), + ] + + operations = [ + migrations.AddField( + model_name="team", + name="external_data_workspace_id", + field=models.CharField(blank=True, max_length=400, null=True), + ), + ] diff --git a/posthog/models/filters/test/__snapshots__/test_filter.ambr b/posthog/models/filters/test/__snapshots__/test_filter.ambr index da49276931993..2b65b1a00ce6f 100644 --- a/posthog/models/filters/test/__snapshots__/test_filter.ambr +++ b/posthog/models/filters/test/__snapshots__/test_filter.ambr @@ -47,7 +47,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -102,7 +103,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -157,7 +159,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -212,7 +215,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -267,7 +271,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 diff --git a/posthog/models/team/team.py b/posthog/models/team/team.py index 0993a7cdd5149..09798021deffc 100644 --- a/posthog/models/team/team.py +++ b/posthog/models/team/team.py @@ -245,6 +245,7 @@ def aggregate_users_by_distinct_id(self) -> bool: event_properties: models.JSONField = models.JSONField(default=list, blank=True) event_properties_with_usage: models.JSONField = models.JSONField(default=list, blank=True) event_properties_numerical: models.JSONField = models.JSONField(default=list, blank=True) + external_data_workspace_id: models.CharField = models.CharField(max_length=400, null=True, blank=True) objects: TeamManager = TeamManager() diff --git a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr index e85c11650cf32..4b146bb0090dc 100644 --- a/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr +++ b/posthog/session_recordings/test/__snapshots__/test_session_recordings.ambr @@ -69,7 +69,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -227,7 +228,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -304,7 +306,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -604,7 +607,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -681,7 +685,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -980,7 +985,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -1057,7 +1063,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -1197,7 +1204,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -1394,7 +1402,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -1500,7 +1509,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -1655,7 +1665,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -1832,7 +1843,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -1909,7 +1921,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -2449,7 +2462,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -2526,7 +2540,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -2818,7 +2833,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -2895,7 +2911,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -3178,7 +3195,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -3266,7 +3284,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ @@ -3551,7 +3570,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 @@ -3628,7 +3648,8 @@ "posthog_team"."primary_dashboard_id", "posthog_team"."extra_settings", "posthog_team"."correlation_config", - "posthog_team"."session_recording_retention_period_days" + "posthog_team"."session_recording_retention_period_days", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 /*controller='project_session_recordings-list',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/session_recordings/%3F%24'*/ diff --git a/posthog/settings/airbyte.py b/posthog/settings/airbyte.py index c337561076d12..00a73e720144a 100644 --- a/posthog/settings/airbyte.py +++ b/posthog/settings/airbyte.py @@ -1,8 +1,7 @@ import os AIRBYTE_API_KEY = os.getenv("AIRBYTE_API_KEY", None) -AIRBYTE_WORKSPACE_ID = os.getenv("AIRBYTE_WORKSPACE_ID", None) AIRBYTE_BUCKET_REGION = os.getenv("AIRBYTE_BUCKET_REGION", None) AIRBYTE_BUCKET_KEY = os.getenv("AIRBYTE_BUCKET_KEY", None) AIRBYTE_BUCKET_SECRET = os.getenv("AIRBYTE_BUCKET_SECRET", None) -AIRBYTE_BUCKET_URL = os.getenv("AIRBYTE_BUCKET_URL", None) +AIRBYTE_BUCKET_DOMAIN = os.getenv("AIRBYTE_BUCKET_DOMAIN", None) diff --git a/posthog/test/__snapshots__/test_feature_flag.ambr b/posthog/test/__snapshots__/test_feature_flag.ambr index 16f00532933cc..f7a912fe972b7 100644 --- a/posthog/test/__snapshots__/test_feature_flag.ambr +++ b/posthog/test/__snapshots__/test_feature_flag.ambr @@ -138,7 +138,8 @@ "posthog_team"."event_names_with_usage", "posthog_team"."event_properties", "posthog_team"."event_properties_with_usage", - "posthog_team"."event_properties_numerical" + "posthog_team"."event_properties_numerical", + "posthog_team"."external_data_workspace_id" FROM "posthog_team" WHERE "posthog_team"."id" = 2 LIMIT 21 diff --git a/posthog/warehouse/api/external_data_source.py b/posthog/warehouse/api/external_data_source.py index c098e88fb5a9c..72a839741f125 100644 --- a/posthog/warehouse/api/external_data_source.py +++ b/posthog/warehouse/api/external_data_source.py @@ -6,6 +6,7 @@ from rest_framework.permissions import IsAuthenticated from rest_framework import filters, serializers, viewsets from posthog.warehouse.models import ExternalDataSource +from posthog.warehouse.external_data_source.workspace import get_or_create_workspace from posthog.warehouse.external_data_source.source import StripeSourcePayload, create_stripe_source, delete_source from posthog.warehouse.external_data_source.connection import create_connection, start_sync from posthog.warehouse.external_data_source.destination import create_destination, delete_destination @@ -50,14 +51,16 @@ def create(self, request: Request, *args: Any, **kwargs: Any) -> Response: account_id = request.data["account_id"] client_secret = request.data["client_secret"] + workspace_id = get_or_create_workspace(self.team_id) + stripe_payload = StripeSourcePayload( account_id=account_id, client_secret=client_secret, ) - new_source = create_stripe_source(stripe_payload) + new_source = create_stripe_source(stripe_payload, workspace_id) try: - new_destination = create_destination(self.team_id) + new_destination = create_destination(self.team_id, workspace_id) except Exception as e: delete_source(new_source.source_id) raise e diff --git a/posthog/warehouse/external_data_source/client.py b/posthog/warehouse/external_data_source/client.py new file mode 100644 index 0000000000000..ef37c92a7c34a --- /dev/null +++ b/posthog/warehouse/external_data_source/client.py @@ -0,0 +1,28 @@ +from django.conf import settings +import requests + + +def send_request(path, method, params=None, payload=None): + token = settings.AIRBYTE_API_KEY + if not token: + raise ValueError("AIRBYTE_API_KEY must be set in order to create a source.") + + headers = {"accept": "application/json", "content-type": "application/json", "Authorization": f"Bearer {token}"} + + if method == "GET": + response = requests.get(path, params=params, headers=headers) + elif method == "POST": + response = requests.post(path, json=payload, headers=headers) + elif method == "PATCH": + response = requests.patch(path, json=payload, headers=headers) + elif method == "DELETE": + response = requests.delete(path, headers=headers) + else: + raise ValueError(f"Invalid method: {method}") + + response_payload = response.json() + + if not response.ok: + raise ValueError(response_payload["detail"]) + + return response_payload diff --git a/posthog/warehouse/external_data_source/connection.py b/posthog/warehouse/external_data_source/connection.py index b0ab472430ccc..38619dc0900fb 100644 --- a/posthog/warehouse/external_data_source/connection.py +++ b/posthog/warehouse/external_data_source/connection.py @@ -1,11 +1,12 @@ -import requests -from django.conf import settings from pydantic import BaseModel -from typing import Dict +from posthog.warehouse.external_data_source.client import send_request +import structlog AIRBYTE_CONNECTION_URL = "https://api.airbyte.com/v1/connections" AIRBYTE_JOBS_URL = "https://api.airbyte.com/v1/jobs" +logger = structlog.get_logger(__name__) + class ExternalDataConnection(BaseModel): connection_id: str @@ -16,12 +17,6 @@ class ExternalDataConnection(BaseModel): def create_connection(source_id: str, destination_id: str) -> ExternalDataConnection: - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to create a source.") - - headers = {"accept": "application/json", "content-type": "application/json", "Authorization": f"Bearer {token}"} - payload = { "schedule": {"scheduleType": "cron", "cronExpression": "0 0 0 * * ?"}, "namespaceFormat": None, @@ -29,24 +24,20 @@ def create_connection(source_id: str, destination_id: str) -> ExternalDataConnec "destinationId": destination_id, } - response = requests.post(AIRBYTE_CONNECTION_URL, json=payload, headers=headers) - response_payload = response.json() + response = send_request(AIRBYTE_CONNECTION_URL, method="POST", payload=payload) - if not response.ok: - raise ValueError(response_payload["message"]) - - update_connection_stream(response_payload["connectionId"], headers) + update_connection_stream(response["connectionId"]) return ExternalDataConnection( - source_id=response_payload["sourceId"], - name=response_payload["name"], - connection_id=response_payload["connectionId"], - workspace_id=response_payload["workspaceId"], - destination_id=response_payload["destinationId"], + source_id=response["sourceId"], + name=response["name"], + connection_id=response["connectionId"], + workspace_id=response["workspaceId"], + destination_id=response["destinationId"], ) -def update_connection_stream(connection_id: str, headers: Dict): +def update_connection_stream(connection_id: str): connection_id_url = f"{AIRBYTE_CONNECTION_URL}/{connection_id}" # TODO: hardcoded to stripe stream right now @@ -56,51 +47,33 @@ def update_connection_stream(connection_id: str, headers: Dict): "namespaceFormat": None, } - response = requests.patch(connection_id_url, json=payload, headers=headers) - response_payload = response.json() - - if not response.ok: - raise ValueError(response_payload["message"]) + send_request(connection_id_url, method="PATCH", payload=payload) def delete_connection(connection_id: str) -> None: - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to delete a connection.") - - headers = {"Authorization": f"Bearer {token}"} - response = requests.delete(AIRBYTE_CONNECTION_URL + "/" + connection_id, headers=headers) - - if not response.ok: - raise ValueError(response.json()["message"]) + send_request(AIRBYTE_CONNECTION_URL + "/" + connection_id, method="DELETE") # Fire and forget def start_sync(connection_id: str): - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to start sync.") - - headers = {"accept": "application/json", "content-type": "application/json", "Authorization": f"Bearer {token}"} payload = {"jobType": "sync", "connectionId": connection_id} - requests.post(AIRBYTE_JOBS_URL, json=payload, headers=headers) + try: + send_request(AIRBYTE_JOBS_URL, method="POST", payload=payload) + except Exception as e: + logger.exception( + f"Sync Resource failed with an unexpected exception for connection id: {connection_id}", exc_info=e + ) def retrieve_sync(connection_id: str): - token = settings.AIRBYTE_API_KEY - headers = {"accept": "application/json", "content-type": "application/json", "Authorization": f"Bearer {token}"} params = {"connectionId": connection_id, "limit": 1} - response = requests.get(AIRBYTE_JOBS_URL, params=params, headers=headers) - response_payload = response.json() - - if not response.ok: - raise ValueError(response_payload["message"]) + response = send_request(AIRBYTE_JOBS_URL, method="GET", params=params) - data = response_payload.get("data", []) + data = response.get("data", []) if not data: return None - latest_job = response_payload["data"][0] + latest_job = response["data"][0] return latest_job diff --git a/posthog/warehouse/external_data_source/destination.py b/posthog/warehouse/external_data_source/destination.py index 46b680ea42f76..eb45744df8340 100644 --- a/posthog/warehouse/external_data_source/destination.py +++ b/posthog/warehouse/external_data_source/destination.py @@ -1,6 +1,6 @@ -import requests from django.conf import settings from pydantic import BaseModel +from posthog.warehouse.external_data_source.client import send_request AIRBYTE_DESTINATION_URL = "https://api.airbyte.com/v1/destinations" @@ -9,11 +9,7 @@ class ExternalDataDestination(BaseModel): destination_id: str -def create_destination(team_id: int) -> ExternalDataDestination: - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to create a source.") - +def create_destination(team_id: int, workspace_id: str) -> ExternalDataDestination: payload = { "configuration": { "format": {"format_type": "Parquet", "compression_codec": "UNCOMPRESSED"}, @@ -25,28 +21,15 @@ def create_destination(team_id: int) -> ExternalDataDestination: "s3_bucket_path": f"airbyte/{team_id}", }, "name": f"S3/{team_id}", - "workspaceId": settings.AIRBYTE_WORKSPACE_ID, + "workspaceId": workspace_id, } - headers = {"accept": "application/json", "content-type": "application/json", "authorization": f"Bearer {token}"} - - response = requests.post(AIRBYTE_DESTINATION_URL, json=payload, headers=headers) - response_payload = response.json() - if not response.ok: - raise ValueError(response_payload["message"]) + response = send_request(AIRBYTE_DESTINATION_URL, method="POST", payload=payload) return ExternalDataDestination( - destination_id=response_payload["destinationId"], + destination_id=response["destinationId"], ) def delete_destination(destination_id: str) -> None: - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to delete a destiantion.") - headers = {"authorization": f"Bearer {token}"} - - response = requests.delete(AIRBYTE_DESTINATION_URL + "/" + destination_id, headers=headers) - - if not response.ok: - raise ValueError(response.json()["message"]) + send_request(AIRBYTE_DESTINATION_URL + "/" + destination_id, method="DELETE") diff --git a/posthog/warehouse/external_data_source/source.py b/posthog/warehouse/external_data_source/source.py index c142ce0c2a861..bacd99e812197 100644 --- a/posthog/warehouse/external_data_source/source.py +++ b/posthog/warehouse/external_data_source/source.py @@ -1,9 +1,8 @@ -import requests -from django.conf import settings from posthog.models.utils import UUIDT from pydantic import BaseModel, field_validator from typing import Dict, Optional import datetime as dt +from posthog.warehouse.external_data_source.client import send_request AIRBYTE_SOURCE_URL = "https://api.airbyte.com/v1/sources" @@ -46,11 +45,7 @@ class ExternalDataSource(BaseModel): workspace_id: str -def create_stripe_source(payload: StripeSourcePayload) -> ExternalDataSource: - workspace_id = settings.AIRBYTE_WORKSPACE_ID - if not workspace_id: - raise ValueError("AIRBYTE_WORKSPACE_ID must be set in order to create a source.") - +def create_stripe_source(payload: StripeSourcePayload, workspace_id: str) -> ExternalDataSource: optional_config = {} if payload.start_date: optional_config["start_date"] = payload.start_date.isoformat() @@ -75,32 +70,14 @@ def create_stripe_source(payload: StripeSourcePayload) -> ExternalDataSource: def _create_source(payload: Dict) -> ExternalDataSource: - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to create a source.") - - headers = {"accept": "application/json", "content-type": "application/json", "Authorization": f"Bearer {token}"} - - response = requests.post(AIRBYTE_SOURCE_URL, json=payload, headers=headers) - response_payload = response.json() - if not response.ok: - raise ValueError(response_payload["message"]) - + response = send_request(AIRBYTE_SOURCE_URL, method="POST", payload=payload) return ExternalDataSource( - source_id=response_payload["sourceId"], - name=response_payload["name"], - source_type=response_payload["sourceType"], - workspace_id=response_payload["workspaceId"], + source_id=response["sourceId"], + name=response["name"], + source_type=response["sourceType"], + workspace_id=response["workspaceId"], ) def delete_source(source_id): - token = settings.AIRBYTE_API_KEY - if not token: - raise ValueError("AIRBYTE_API_KEY must be set in order to delete a source.") - headers = {"authorization": f"Bearer {token}"} - - response = requests.delete(AIRBYTE_SOURCE_URL + "/" + source_id, headers=headers) - - if not response.ok: - raise ValueError(response.json()["message"]) + send_request(AIRBYTE_SOURCE_URL + "/" + source_id, method="DELETE") diff --git a/posthog/warehouse/external_data_source/workspace.py b/posthog/warehouse/external_data_source/workspace.py new file mode 100644 index 0000000000000..086f7c46def96 --- /dev/null +++ b/posthog/warehouse/external_data_source/workspace.py @@ -0,0 +1,22 @@ +from posthog.models import Team +from posthog.warehouse.external_data_source.client import send_request + +AIRBYTE_WORKSPACE_URL = "https://api.airbyte.com/v1/workspaces" + + +def create_workspace(team_id: int): + payload = {"name": "Team " + str(team_id)} + response = send_request(AIRBYTE_WORKSPACE_URL, method="POST", payload=payload) + + return response["workspaceId"] + + +def get_or_create_workspace(team_id: int): + team = Team.objects.get(id=team_id) + + if not team.external_data_workspace_id: + workspace_id = create_workspace(team_id) + team.external_data_workspace_id = workspace_id + team.save() + + return team.external_data_workspace_id diff --git a/posthog/warehouse/sync_resource.py b/posthog/warehouse/sync_resource.py index 7b9c20ce3deb4..886bd00feadef 100644 --- a/posthog/warehouse/sync_resource.py +++ b/posthog/warehouse/sync_resource.py @@ -45,7 +45,7 @@ def _sync_resource(resource_id): "credential": credential, "name": "stripe_customers", "format": "Parquet", - "url_pattern": f"{settings.AIRBYTE_BUCKET_URL}/{resource.team.pk}/customers/*.parquet", + "url_pattern": f"https://{settings.AIRBYTE_BUCKET_DOMAIN}/airbyte/{resource.team.pk}/customers/*.parquet", "team_id": resource.team.pk, }