Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified frontend/__snapshots__/components-search--default--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/__snapshots__/components-search--default--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ export const sourceWizardLogic = kea<sourceWizardLogicType>([

if (schema.sync_type === null) {
showToast = true
schema.should_sync = true
schema.should_sync = schema.should_sync_default ?? true

// Use incremental if available
if (schema.incremental_available || schema.append_available) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,8 @@ const SyncMethodModal = ({ schema }: { schema: ExternalDataSourceSchema }): JSX.
schema={{
table: currentSyncMethodModalSchema.name,
should_sync: currentSyncMethodModalSchema.should_sync,
description: currentSyncMethodModalSchema.description,
should_sync_default: currentSyncMethodModalSchema.should_sync_default ?? true,
sync_type: currentSyncMethodModalSchema.sync_type,
sync_time_of_day: currentSyncMethodModalSchema.sync_time_of_day ?? '00:00:00',
incremental_field: currentSyncMethodModalSchema.incremental_field ?? null,
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5528,6 +5528,7 @@ export interface ExternalDataSourceSyncSchema {
append_available: boolean
supports_webhooks: boolean
description?: string | null
should_sync_default: boolean
}

export interface ExternalDataSourceSchema extends SimpleExternalDataSourceSchema {
Expand All @@ -5541,6 +5542,7 @@ export interface ExternalDataSourceSchema extends SimpleExternalDataSourceSchema
incremental_field_type: string | null
sync_frequency: DataWarehouseSyncInterval
description?: string | null
should_sync_default?: boolean
}

export enum ExternalDataSchemaStatus {
Expand Down
1 change: 1 addition & 0 deletions posthog/temporal/data_imports/sources/common/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ class SourceSchema:
columns: list[tuple[str, str, bool]] = field(default_factory=list)
foreign_keys: list[tuple[str, str, str]] = field(default_factory=list)
description: str | None = None
should_sync_default: bool = True
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,16 @@ def __init__(
*args,
requires_filter: bool,
primary_key: list[str],
should_sync_default: bool,
description: str | None,
partition_keys: list[str] | None = None,
extra_where: str | None = None,
**kwargs,
):
self.requires_filter = requires_filter
self.primary_key = [pkey.replace(".", "_") for pkey in primary_key]
self.should_sync_default = should_sync_default
self.description = description
self.partition_keys = [pkey.replace(".", "_") for pkey in partition_keys] if partition_keys else None
self.extra_where = extra_where
super().__init__(*args, **kwargs)
Expand Down Expand Up @@ -303,6 +307,9 @@ def get_schemas(config: GoogleAdsSourceConfigUnion, team_id: int) -> TableSchema
extra_where = typing.cast(str | None, resource_contents.get("extra_where", None))
partition_keys = typing.cast(list[str] | None, resource_contents.get("partition_keys", None))

should_sync_default = resource_contents.get("should_sync_default", True)
description = resource_contents.get("description", None)

columns = []

for field_name in field_names:
Expand Down Expand Up @@ -335,6 +342,8 @@ def get_schemas(config: GoogleAdsSourceConfigUnion, team_id: int) -> TableSchema
partition_keys=partition_keys,
columns=columns,
parents=None,
should_sync_default=should_sync_default,
description=description,
)
table_schemas[table_alias] = table

Expand Down
3 changes: 2 additions & 1 deletion posthog/temporal/data_imports/sources/google_ads/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,8 @@
"customer.id",
"segments.date",
],
"filter_field_names": [("segments.date", IncrementalFieldType.Date)],
"should_sync_default": False,
"description": "This table can load hundreds of millions of rows for active campaigns. We don't recommend enabling this table unless you know you need it.",
"extra_where": "metrics.impressions > 0",
"partition_keys": ["segments.date", "campaign.id", "geographic_view.country_criterion_id"],
"field_names": [
Expand Down
4 changes: 3 additions & 1 deletion posthog/temporal/data_imports/sources/google_ads/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ def get_schemas(
{"label": column_name, "type": column_type, "field": column_name, "field_type": column_type}
for column_name, column_type in ads_incremental_fields.get(endpoint, [])
],
description=endpoint_config.description,
should_sync_default=endpoint_config.should_sync_default,
)
for endpoint in google_ads_schemas.keys()
for endpoint, endpoint_config in google_ads_schemas.items()
]

if names is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ def database_schema(self, request: Request, *arg: Any, **kwargs: Any):
"rows": schema.row_count,
"supports_webhooks": schema.supports_webhooks,
"description": schema.description,
"should_sync_default": schema.should_sync_default,
}
for schema in schemas
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1505,6 +1505,7 @@ def test_internal_postgres(
{
"table": "table_1",
"should_sync": False,
"should_sync_default": True,
"description": None,
"rows": 42,
"incremental_fields": [
Expand Down Expand Up @@ -1556,6 +1557,7 @@ def test_internal_postgres(
{
"table": "table_1",
"should_sync": False,
"should_sync_default": True,
"description": None,
"rows": 42,
"incremental_fields": [
Expand Down
Loading