:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): filter shopify tables on created_at (#114010)
Daniel RC2eb19c419f4a
diff --git a/frontend/src/types.ts b/frontend/src/types.tsindex e99577486c1b..2a4cc8e58be9 100644--- a/frontend/src/types.ts+++ b/frontend/src/types.ts@@ -113,6 +113,7 @@ import type { TaskRuntimeEnumApi } from 'products/tasks/frontend/generated/api.simport type {ExternalDataSourceTypeEnumApi,IncrementalSyncBlockedReasonEnumApi,+ RowFilterColumnApi,} from 'products/warehouse_sources/frontend/generated/api.schemas'import { CyclotronInputType } from 'products/workflows/frontend/Workflows/hogflows/steps/types'import type { HogFlow } from 'products/workflows/frontend/Workflows/hogflows/types'@@ -6730,6 +6731,8 @@ export interface ExternalDataSourceSchema extends SimpleExternalDataSourceSchema* `null` means "sync all rows". Applied on the next sync — not retroactive.*/row_filters?: RowFilter[] | null+ /** Columns a row filter may use; null means any column in `available_columns`. */+ row_filter_columns?: readonly RowFilterColumnApi[] | null/** User-managed vendor API version override; null syncs on the source's pinned version */api_version?: string | null/** Set when this schema's version override is deprecated by the vendor */diff --git a/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx b/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsxindex ab263fca5d88..1b260fa57fa7 100644--- a/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx+++ b/products/data_warehouse/frontend/scenes/SchemaScene/ConfigurationTab.tsx@@ -729,7 +729,10 @@ function ColumnsAndRowFiltersSection({const rowFiltersSummary =filterCount === 0 ? 'Syncing all rows' : `${filterCount} ${filterCount === 1 ? 'filter' : 'filters'} active`- const rowFilterErrors = validateRowFilters(draftRowFilters ?? [], { availableColumns: available })+ // A source that filters on a fixed set of columns lists them; other sources filter on any synced column.+ const rowFilterColumns = schema.row_filter_columns ?? available+ const rowFilterSchema = schema.row_filter_columns ? { ...schema, available_columns: rowFilterColumns } : schema+ const rowFilterErrors = validateRowFilters(draftRowFilters ?? [], { availableColumns: rowFilterColumns })const hasRowFilterErrors = Object.keys(rowFilterErrors).length > 0const isDirty =@@ -828,31 +831,38 @@ function ColumnsAndRowFiltersSection({</div></div>- {supportsRowFilters && source?.access_method !== 'direct' && schema.sync_type !== 'cdc' && (- <div>- <SectionHeader- title="Row filters"- description="Sync only rows that match these conditions. Filters are ANDed together and applied on the next sync — they don't remove rows already synced."- />- <div className="border rounded p-4 bg-surface-primary flex flex-col gap-3">- {!hasAvailableColumns || columnSelectionNeedsRefresh ? (- <div className="text-sm text-muted-alt py-2 text-center">- No columns discovered yet — pull schemas from the Columns section above to add row- filters.- </div>- ) : (- <>- <span className="text-sm text-secondary">{rowFiltersSummary}</span>- <fieldset disabled={!!editorDisabledReason}>- <RowFilterEditor hideActions schema={schema} onChange={setDraftRowFilters} />- </fieldset>- </>- )}+ {supportsRowFilters &&+ source?.access_method !== 'direct' &&+ schema.sync_type !== 'cdc' &&+ schema.row_filter_columns?.length !== 0 && (+ <div>+ <SectionHeader+ title="Row filters"+ description="Sync only rows that match these conditions. Filters are ANDed together and applied on the next sync — they don't remove rows already synced."+ />+ <div className="border rounded p-4 bg-surface-primary flex flex-col gap-3">+ {!schema.row_filter_columns && (!hasAvailableColumns || columnSelectionNeedsRefresh) ? (+ <div className="text-sm text-muted-alt py-2 text-center">+ No columns discovered yet — pull schemas from the Columns section above to add row+ filters.+ </div>+ ) : (+ <>+ <span className="text-sm text-secondary">{rowFiltersSummary}</span>+ <fieldset disabled={!!editorDisabledReason}>+ <RowFilterEditor+ hideActions+ schema={rowFilterSchema}+ onChange={setDraftRowFilters}+ />+ </fieldset>+ </>+ )}+ </div></div>- </div>- )}+ )}- {hasAvailableColumns && (+ {(hasAvailableColumns || !!schema.row_filter_columns?.length) && (<div className="flex justify-end"><LemonButtontype="primary"diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.test.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.test.tsxnew file mode 100644index 000000000000..560a9bd5595a--- /dev/null+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.test.tsx@@ -0,0 +1,39 @@+import '@testing-library/jest-dom'++import { cleanup, fireEvent, render, screen } from '@testing-library/react'++import { initKeaTests } from '~/test/init'++import { RowFilterEditor } from './RowFilterEditor'++describe('RowFilterEditor', () => {+ beforeEach(() => {+ initKeaTests()+ })++ afterEach(() => {+ cleanup()+ })++ test.each([+ ['every operator is allowed', undefined, '='],+ ['the column limits its operators', ['>', '>=', '<', '<='], '>'],+ ])('a new filter starts on an operator the column accepts when %s', (_name, operators, expected) => {+ const onChange = jest.fn()+ render(+ <RowFilterEditor+ hideActions+ schema={{+ id: 'orders',+ row_filters: null,+ available_columns: [{ name: 'created_at', data_type: 'timestamp', operators }],+ }}+ onChange={onChange}+ />+ )++ fireEvent.click(screen.getByText('Add filter'))++ expect(onChange).toHaveBeenLastCalledWith([{ column: 'created_at', operator: expected, value: '' }])+ })+})diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.tsx b/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.tsxindex fef76fb0119e..7c2a63ca163b 100644--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.tsx+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/RowFilterEditor.tsx@@ -21,7 +21,13 @@ export interface RowFilterTarget {id?: stringname?: stringrow_filters?: RowFilter[] | null- available_columns?: { name: string; data_type?: string; is_nullable?: boolean }[]+ /** `operators` limits the comparisons a column accepts; without it every operator is offered. */+ available_columns?: readonly {+ name: string+ data_type?: string+ is_nullable?: boolean+ operators?: readonly string[]+ }[]}interface RowFilterEditorProps {@@ -76,12 +82,26 @@ export function RowFilterEditor({ schema, onSave, hideActions, onChange }: RowFiconst categoryFor = (column: string): RowFilterColumnCategory =>classifyColumnType(available.find((c) => c.name === column)?.data_type)+ const operatorsFor = (column: string): RowFilterOperator[] => {+ const allowed = available.find((c) => c.name === column)?.operators+ return allowed ? ROW_FILTER_OPERATORS.filter((op) => allowed.includes(op)) : ROW_FILTER_OPERATORS+ }++ const defaultOperatorFor = (column: string): RowFilterOperator => {+ const operators = operatorsFor(column)+ return operators.includes(DEFAULT_OPERATOR) ? DEFAULT_OPERATOR : (operators[0] ?? DEFAULT_OPERATOR)+ }+const addFilter = (): void => {const firstColumn = available[0]?.name ?? ''const category = categoryFor(firstColumn)applyFilters([...filters,- { column: firstColumn, operator: DEFAULT_OPERATOR, value: defaultValueForCategory(category) },+ {+ column: firstColumn,+ operator: defaultOperatorFor(firstColumn),+ value: defaultValueForCategory(category),+ },])}@@ -99,6 +119,9 @@ export function RowFilterEditor({ schema, onSave, hideActions, onChange }: RowFi// On column change, reset the value if the type category changed (don't carry a// date string onto an integer column).if (patch.column && patch.column !== filter.column) {+ if (!operatorsFor(patch.column).includes(merged.operator)) {+ merged.operator = defaultOperatorFor(patch.column)+ }const prevCategory = categoryFor(filter.column)const nextCategory = categoryFor(patch.column)if (prevCategory !== nextCategory) {@@ -142,7 +165,7 @@ export function RowFilterEditor({ schema, onSave, hideActions, onChange }: RowFi<LemonSelectvalue={filter.operator}onChange={(value) => patchFilter(index, { operator: value as RowFilterOperator })}- options={ROW_FILTER_OPERATORS.map((op) => ({+ options={operatorsFor(filter.column).map((op) => ({value: op,label: op,labelInMenu: rowFilterOperatorLabel(op),diff --git a/products/data_warehouse/frontend/scenes/SourceScene/tabs/rowFilterUtils.ts b/products/data_warehouse/frontend/scenes/SourceScene/tabs/rowFilterUtils.tsindex 576ddcbb9182..1a3f979e1674 100644--- a/products/data_warehouse/frontend/scenes/SourceScene/tabs/rowFilterUtils.ts+++ b/products/data_warehouse/frontend/scenes/SourceScene/tabs/rowFilterUtils.ts@@ -309,7 +309,7 @@ export function validateInListValue(}export interface RowFilterValidationContext {- availableColumns: { name: string; data_type?: string }[]+ availableColumns: readonly { name: string; data_type?: string }[]}/** Validate every filter. Returns a per-index error map (empty when all valid). */diff --git a/products/warehouse_sources/backend/presentation/views/external_data_schema.py b/products/warehouse_sources/backend/presentation/views/external_data_schema.pyindex 1f27f54a07ef..1f8d2a4898ae 100644--- a/products/warehouse_sources/backend/presentation/views/external_data_schema.py+++ b/products/warehouse_sources/backend/presentation/views/external_data_schema.py@@ -122,6 +122,20 @@ def source_supports_row_filters(source_type: str) -> bool:return bool(source.supports_row_filters)+def source_row_filter_columns(source_type: str, schema_name: str) -> tuple[Any, ...] | None:+ """The columns a row filter on this schema may use, or None when any column of the table may.++ Each column has `name`, `data_type` and `operators`. The class stays inside the sources+ package, so this layer does not name it.+ """+ try:+ source = SourceRegistry.get_source(ExternalDataSourceType(source_type))+ except Exception as e:+ capture_exception(e)+ return None+ return source.row_filter_columns_for_schema(schema_name)++def source_requires_exact_column_metadata(source_type: str) -> bool:"""Whether enabled column names are interpolated into a source-side query.@@ -430,6 +444,14 @@ def redact_schema_error(schema: ExternalDataSchema, context: dict[str, Any]) ->return source_helpers.redact_error_message(schema.latest_error, secret_values)+class RowFilterColumnSerializer(serializers.Serializer):+ name = serializers.CharField(help_text="Column name to use as `column` in a row filter.")+ data_type = serializers.CharField(help_text="Column type, which decides the format of the filter value.")+ operators = serializers.ListField(+ child=serializers.CharField(), help_text="Operators a row filter on this column may use."+ )++class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers.ModelSerializer):"""A schema of an external data source: its sync configuration and the warehouse table it syncs into."""@@ -557,6 +579,15 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers"Applied on the next sync — not retroactive to already-synced rows."),)+ row_filter_columns = serializers.SerializerMethodField(+ read_only=True,+ help_text=(+ "Columns a row filter on this schema may use, with the operators each accepts. `null` means "+ "any column in `available_columns` with any operator, which is the case for SQL sources. "+ "A list means the source can filter on these columns only; an empty list means this "+ "schema accepts no row filter."+ ),+ )api_version = serializers.CharField(required=False,allow_null=True,@@ -621,6 +652,7 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers"incremental_sync_blocked","enabled_columns","row_filters",+ "row_filter_columns","available_columns","source_column_metadata_available","source",@@ -640,6 +672,7 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers"incremental_sync_blocked","next_full_refresh_at","description",+ "row_filter_columns","available_columns","source_column_metadata_available","source",@@ -745,6 +778,16 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializersreturn Nonereturn uac.get_user_access_level(schema.table or schema.source)+ @extend_schema_field(RowFilterColumnSerializer(many=True, allow_null=True))+ def get_row_filter_columns(self, schema: ExternalDataSchema) -> list[dict[str, Any]] | None:+ columns = source_row_filter_columns(schema.source.source_type, schema.name)+ if columns is None:+ return None+ return [+ {"name": column.name, "data_type": column.data_type, "operators": list(column.operators)}+ for column in columns+ ]+@extend_schema_field(ExternalDataSourceApiVersionDeprecationSerializer(allow_null=True))def get_api_version_deprecation(self, schema: ExternalDataSchema) -> dict[str, Any] | None:# Only the schema-level override is judged here; a deprecated source pin surfaces on the@@ -984,7 +1027,11 @@ class ExternalDataSchemaSerializer(UserAccessControlSerializerMixin, serializers):raise ValidationError(reason)try:- validate_and_coerce_row_filters(validated_data["row_filters"], instance.schema_metadata)+ validate_and_coerce_row_filters(+ validated_data["row_filters"],+ instance.schema_metadata,+ source_row_filter_columns(instance.source.source_type, instance.name),+ )except RowFilterValidationError as e:raise ValidationError(f"Invalid row filter: {e}")diff --git a/products/warehouse_sources/backend/presentation/views/external_data_source/source_setup.py b/products/warehouse_sources/backend/presentation/views/external_data_source/source_setup.pyindex 3658d339ddc0..c343d489e108 100644--- a/products/warehouse_sources/backend/presentation/views/external_data_source/source_setup.py+++ b/products/warehouse_sources/backend/presentation/views/external_data_source/source_setup.py@@ -1611,7 +1611,9 @@ class ExternalDataSourceSetupMixin(base.ExternalDataSourceViewSetBase):data={"message": f"Row filter not allowed for schema '{schema_name}': {reason}"},)try:- validate_and_coerce_row_filters(row_filters, schema_metadata)+ validate_and_coerce_row_filters(+ row_filters, schema_metadata, source.row_filter_columns_for_schema(schema_name)+ )except RowFilterValidationError as e:new_source_model.delete()return Response(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.pyindex 9046f919a99a..03b1d0bc1d3d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/base.py@@ -14,6 +14,7 @@ if TYPE_CHECKING:from posthog.cdp.templates.hog_function_template import HogFunctionTemplateDCfrom products.warehouse_sources.backend.models.external_data_source import ExternalDataSource+ from products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.predicates import RowFilterColumnfrom products.warehouse_sources.backend.facade.source_config import (SourceConfig,@@ -211,6 +212,14 @@ class _BaseSource(ABC, Generic[ConfigType]):"""return self.history_lookback+ def row_filter_columns_for_schema(self, schema_name: str) -> tuple["RowFilterColumn", ...] | None:+ """The columns a row filter on one schema may use, or None for every column of the table.++ Override in a source whose API filters on a fixed set of fields. An empty tuple means the+ schema accepts no row filter. Only read when `supports_row_filters` is True.+ """+ return None+@property@abstractmethoddef source_type(self) -> ExternalDataSourceType:diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/__init__.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/__init__.pyindex 78c91e956eae..1c66ee0e1274 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/__init__.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/__init__.py@@ -31,6 +31,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.sqlfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.predicates import (ColumnTypeCategory,RowFilter,+ RowFilterColumn,RowFilterValidationError,ValidatedRowFilter,classify_column_type,@@ -77,6 +78,7 @@ __all__ = ["InvalidIdentifierError","ParamStyle","RowFilter",+ "RowFilterColumn","RowFilterValidationError","SafeSQL","SelectQueryBuilder",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/predicates.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/predicates.pyindex 4e4530eb968d..96898a0b4cbc 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/predicates.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/predicates.py@@ -15,11 +15,14 @@ Three rails make SQL injection impossible by construction:from __future__ import annotationsimport enum+from collections.abc import Sequencefrom dataclasses import dataclassfrom datetime import date, datetime, timefrom decimal import Decimal, InvalidOperationfrom typing import Any, TypedDict+from posthog.dataclasses import frozen+from products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.identifiers import IdentifierQuoterfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.metadata import (extract_available_column_names,@@ -61,6 +64,19 @@ class ValidatedRowFilter:category: ColumnTypeCategory+@frozen+class RowFilterColumn:+ """A column a row filter may use, for a source that can filter on a fixed set only.++ A SQL source filters on any column of the table, so it declares none of these. An API source+ declares the fields its API accepts as a filter, with the comparisons that API supports.+ """++ name: str+ data_type: str+ operators: tuple[str, ...]++# The only operators that may reach SQL; input aliases normalize to these._SCALAR_OPERATORS = frozenset({">", ">=", "<", "<=", "=", "!="})# Take a list of values, emitted as `(%s, %s, ...)`. Case-insensitive on input.@@ -416,12 +432,16 @@ def _column_types(schema_metadata: dict[str, Any] | None) -> dict[str, str]:def validate_and_coerce_row_filters(row_filters: Any,schema_metadata: dict[str, Any] | None,+ filterable_columns: Sequence[RowFilterColumn] | None = None,) -> list[ValidatedRowFilter]:"""Validate raw row filters against a schema's columns and coerce their values.Returns an empty list for `None`/empty input. Raises `RowFilterValidationError`on a malformed structure, unknown column, disallowed operator, unclassifiabletype, or a value that doesn't match the column's type.++ `filterable_columns` replaces `schema_metadata` as the set of columns, for a source that+ declares the columns and comparisons its API can filter on."""if row_filters is None:return []@@ -430,8 +450,14 @@ def validate_and_coerce_row_filters(if len(row_filters) > MAX_ROW_FILTERS:raise RowFilterValidationError(f"Too many row filters (max {MAX_ROW_FILTERS})")- available_columns = extract_available_column_names(schema_metadata)- column_types = _column_types(schema_metadata)+ allowed_operators: dict[str, tuple[str, ...]] | None = None+ if filterable_columns is None:+ available_columns = extract_available_column_names(schema_metadata)+ column_types = _column_types(schema_metadata)+ else:+ available_columns = {column.name for column in filterable_columns}+ column_types = {column.name: column.data_type for column in filterable_columns}+ allowed_operators = {column.name: column.operators for column in filterable_columns}validated: list[ValidatedRowFilter] = []for index, row_filter in enumerate(row_filters):@@ -441,10 +467,20 @@ def validate_and_coerce_row_filters(column = row_filter.get("column")if not isinstance(column, str) or not column:raise RowFilterValidationError(f"Row filter at index {index} is missing a column")+ if allowed_operators is not None and column not in allowed_operators:+ allowed = ", ".join(sorted(allowed_operators)) or "none"+ raise RowFilterValidationError(+ f"Cannot filter on column {column!r}: this table can be filtered on these columns only: {allowed}"+ )if available_columns and column not in available_columns:raise RowFilterValidationError(f"Unknown column {column!r} for this schema")operator = normalize_operator(row_filter.get("operator"))+ if allowed_operators is not None and operator not in allowed_operators[column]:+ raise RowFilterValidationError(+ f"Unsupported operator {operator!r} for column {column!r}. "+ f"Allowed operators: {', '.join(allowed_operators[column])}"+ )data_type = column_types.get(column)category = classify_column_type(data_type)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/tests/test_predicates.py b/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/tests/test_predicates.pyindex 8c1e9746abf9..b28a375a8f01 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/tests/test_predicates.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/common/sql/tests/test_predicates.py@@ -19,6 +19,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.sql_STRING_TYPES,_TIMESTAMP_TYPES,ColumnTypeCategory,+ RowFilterColumn,RowFilterValidationError,ValidatedRowFilter,classify_column_type,@@ -192,6 +193,39 @@ class TestValidateAndCoerce:[{"column": "geo", "operator": "=", "value": "x"}], _metadata([("geo", "geometry")]))+ @pytest.mark.parametrize(+ "row_filter, expected_error",+ [+ ({"column": "created_at", "operator": ">=", "value": "2024-01-01"}, None),+ ({"column": "id", "operator": ">=", "value": 1}, "can be filtered on these columns only: created_at"),+ ({"column": "created_at", "operator": "!=", "value": "2024-01-01"}, "Unsupported operator '!='"),+ ],+ )+ def test_filterable_columns_replace_schema_metadata(+ self, row_filter: dict[str, object], expected_error: str | None+ ) -> None:+ filterable = [RowFilterColumn(name="created_at", data_type="timestamp", operators=(">", ">="))]+ metadata = _metadata([("id", "integer")])+ if expected_error is None:+ result = validate_and_coerce_row_filters([row_filter], metadata, filterable)+ assert result == [+ ValidatedRowFilter(+ column="created_at",+ operator=">=",+ value=datetime(2024, 1, 1),+ category=ColumnTypeCategory.TIMESTAMP,+ )+ ]+ else:+ with pytest.raises(RowFilterValidationError, match=expected_error):+ validate_and_coerce_row_filters([row_filter], metadata, filterable)++ def test_empty_filterable_columns_reject_every_filter(self) -> None:+ with pytest.raises(RowFilterValidationError, match="these columns only: none"):+ validate_and_coerce_row_filters(+ [{"column": "id", "operator": ">", "value": 1}], _metadata([("id", "integer")]), []+ )+def test_filter_at_index_must_be_object(self) -> None:with pytest.raises(RowFilterValidationError, match="must be an object"):validate_and_coerce_row_filters(["not a dict"], _metadata([("id", "integer")]))diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/settings.pyindex 99445f271db8..29955e44a550 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/settings.py@@ -25,7 +25,7 @@ from products.warehouse_sources.backend.types import IncrementalField, Increment# TODO: andrew - pull EndpointConfig out from reddit_ads and into common place. make this extend that class# to include query_filter for graphql endpoints-@dataclass+@dataclass(frozen=True)class ShopifyEndpointConfig:fields: list[IncrementalField]query_filter: str | None@@ -36,6 +36,10 @@ class ShopifyEndpointConfig:partition_keys: list[str] = field(default_factory=lambda: [CREATED_AT])incremental_field_resolver: Callable | None = Nonepartition_key_resolver: Callable | None = None+ # The search field that filters this resource on its creation time, or None when Shopify has+ # none. Shopify ignores a search on a field it does not know and returns every row, so set+ # this only to a field the resource's `query` argument documents.+ created_at_search_field: str | None = NoneENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {@@ -49,6 +53,7 @@ ENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {},],query_filter=CREATED_AT,+ created_at_search_field="created_at",),ARTICLES: ShopifyEndpointConfig(fields=[@@ -60,6 +65,7 @@ ENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {},],query_filter=UPDATED_AT,+ created_at_search_field="created_at",),BLOGS: ShopifyEndpointConfig(fields=[],@@ -105,6 +111,7 @@ ENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {},],query_filter=UPDATED_AT,+ created_at_search_field="customer_date",),DISCOUNT_NODES: ShopifyEndpointConfig(fields=[@@ -116,6 +123,7 @@ ENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {},],query_filter=UPDATED_AT,+ created_at_search_field="created_at",incremental_field_resolver=lambda row: safe_set(row, path="updatedAt", value=unwrap(row, path="discount.updatedAt")),@@ -133,6 +141,7 @@ ENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {},],query_filter=UPDATED_AT,+ created_at_search_field="created_at",),PRODUCTS: ShopifyEndpointConfig(fields=[@@ -144,5 +153,6 @@ ENDPOINT_CONFIGS: dict[str, ShopifyEndpointConfig] = {},],query_filter=UPDATED_AT,+ created_at_search_field="created_at",),}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.pyindex 60441039c578..05089fd8b4ee 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/shopify.py@@ -2,6 +2,7 @@ import reimport jsonimport dataclassesfrom collections.abc import Iterator+from datetime import UTC, datetimefrom typing import Anyimport requests@@ -15,8 +16,13 @@ from posthog.exceptions_capture import capture_exceptionfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.http import make_tracked_sessionfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManager+from products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.predicates import ValidatedRowFilterfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceResponse-from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.constants import ID, resolve_schema_name+from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.constants import (+ CREATED_AT,+ ID,+ resolve_schema_name,+)from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.settings import ENDPOINT_CONFIGSfrom products.warehouse_sources.backend.temporal.data_imports.sources.shopify.utils import (ShopifyGraphQLObject,@@ -554,6 +560,37 @@ def _get_granted_scopes(store_id: str, sess: requests.Session) -> set[str] | Nonreturn {scope["handle"] for scope in scopes if isinstance(scope, dict) and "handle" in scope}+# The comparisons Shopify's search syntax has for a date field.+CREATED_AT_FILTER_OPERATORS = (">", ">=", "<", "<=")+++def row_filter_search_terms(schema_name: str, row_filters: list[ValidatedRowFilter] | None) -> list[str]:+ """Shopify search terms for the row filters of one resource.++ Raises on a filter that has no search term. A filter that is dropped here would sync every+ row while the schema still shows the filter.+ """+ if not row_filters:+ return []+ endpoint_config = ENDPOINT_CONFIGS.get(schema_name)+ search_field = endpoint_config.created_at_search_field if endpoint_config else None+ terms: list[str] = []+ for row_filter in row_filters:+ if (+ search_field is None+ or row_filter.column != CREATED_AT+ or row_filter.operator not in CREATED_AT_FILTER_OPERATORS+ or not isinstance(row_filter.value, datetime)+ ):+ raise ValueError(+ f"Shopify cannot apply the row filter on {row_filter.column!r} to {schema_name}. "+ "Remove the row filter in the schema's configuration to resume syncing."+ )+ value = row_filter.value if row_filter.value.tzinfo else row_filter.value.replace(tzinfo=UTC)+ terms.append(f"{search_field}:{row_filter.operator}'{value.isoformat()}'")+ return terms++def shopify_source(shopify_store_id: str,shopify_client_id: str | None,@@ -566,11 +603,13 @@ def shopify_source(api_version: str = SHOPIFY_API_VERSION_2026_07,should_use_incremental_field: bool = False,shopify_access_token: str | None = None,+ row_filters: list[ValidatedRowFilter] | None = None,):store_id = normalize_store_id(shopify_store_id)api_url = SHOPIFY_API_URL.format(store_id, api_version)access_token = _resolve_access_token(store_id, shopify_client_id, shopify_client_secret, shopify_access_token)schema_name = resolve_schema_name(graphql_object_name)+ filter_terms = row_filter_search_terms(schema_name, row_filters)def get_rows():sess = make_tracked_session(@@ -615,6 +654,7 @@ def shopify_source(sess,graphql_object,logger,+ query=" AND ".join(filter_terms) or None,phase=PHASE_ALL,initial_cursor=initial_cursor,resumable_source_manager=resumable_source_manager,@@ -633,7 +673,7 @@ def shopify_source(logger.debug(f"Shopify: iterating earliest objects from source: {query_filter} < {db_incremental_field_earliest_value}")- query = f"{query_filter}:<'{db_incremental_field_earliest_value}'"+ query = " AND ".join([f"{query_filter}:<'{db_incremental_field_earliest_value}'", *filter_terms])initial_cursor = (resume_config.cursor if resume_config is not None and resume_config.phase == PHASE_EARLIEST else None)@@ -653,7 +693,7 @@ def shopify_source(logger.debug(f"Shopify: iterating latest objects from source: {query_filter} > {db_incremental_field_last_value}")- query = f"{query_filter}:>'{db_incremental_field_last_value}'"+ query = " AND ".join([f"{query_filter}:>'{db_incremental_field_last_value}'", *filter_terms])initial_cursor = (resume_config.cursor if resume_config is not None and resume_config.phase == PHASE_LATEST else None)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.pyindex da6f9e1a1862..f0c9ec056a9d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.py@@ -21,17 +21,21 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.common.canfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.registry import SourceRegistryfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.resumable import ResumableSourceManagerfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.schema import SourceSchema+from products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.predicates import RowFilterColumnfrom products.warehouse_sources.backend.temporal.data_imports.sources.common.typings import SourceInputs, SourceResponsefrom products.warehouse_sources.backend.temporal.data_imports.sources.generated_configs.shopify import (ShopifySourceConfig,)from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.constants import (+ CREATED_AT,SHOPIFY_API_VERSION_2025_10,SHOPIFY_API_VERSION_2026_07,SHOPIFY_GRAPHQL_OBJECTS,+ resolve_schema_name,)from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.settings import ENDPOINT_CONFIGSfrom products.warehouse_sources.backend.temporal.data_imports.sources.shopify.shopify import (+ CREATED_AT_FILTER_OPERATORS,SHOPIFY_ACCESS_TOKEN_APP_NOT_INSTALLED_ERROR,SHOPIFY_ACCESS_TOKEN_AUTH_ERROR,SHOPIFY_ACCESS_TOKEN_INVALID_CLIENT_ERROR,@@ -69,6 +73,14 @@ class ShopifySource(ResumableSource[ShopifySourceConfig, ShopifyResumeConfig]):lists_tables_without_credentials = True # static endpoint catalog — safe for public docs+ supports_row_filters = True++ def row_filter_columns_for_schema(self, schema_name: str) -> tuple[RowFilterColumn, ...]:+ endpoint_config = ENDPOINT_CONFIGS.get(resolve_schema_name(schema_name))+ if endpoint_config is None or endpoint_config.created_at_search_field is None:+ return ()+ return (RowFilterColumn(name=CREATED_AT, data_type="timestamp", operators=CREATED_AT_FILTER_OPERATORS),)+@propertydef source_type(self) -> ExternalDataSourceType:return ExternalDataSourceType.SHOPIFY@@ -327,4 +339,5 @@ class ShopifySource(ResumableSource[ShopifySourceConfig, ShopifyResumeConfig]):db_incremental_field_earliest_value=inputs.db_incremental_field_earliest_value,logger=inputs.logger,resumable_source_manager=resumable_source_manager,+ row_filters=inputs.row_filters,)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_row_filters.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_row_filters.pynew file mode 100644index 000000000000..176fbd9a4099--- /dev/null+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_row_filters.py@@ -0,0 +1,157 @@+from datetime import UTC, datetime+from typing import Any++import pytest+from unittest.mock import MagicMock, patch++from products.warehouse_sources.backend.temporal.data_imports.sources.common.sql.predicates import (+ ColumnTypeCategory,+ RowFilterColumn,+ ValidatedRowFilter,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.constants import (+ BLOGS,+ COLLECTIONS,+ CUSTOMERS,+ ORDERS,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.shopify import (+ row_filter_search_terms,+ shopify_source,+)+from products.warehouse_sources.backend.temporal.data_imports.sources.shopify.source import ShopifySource++CREATED_AT_COLUMN = RowFilterColumn(name="created_at", data_type="timestamp", operators=(">", ">=", "<", "<="))+++def _created_at_filter(operator: str, value: datetime) -> ValidatedRowFilter:+ return ValidatedRowFilter(+ column="created_at", operator=operator, value=value, category=ColumnTypeCategory.TIMESTAMP+ )+++def _response(object_name: str) -> MagicMock:+ response = MagicMock()+ response.status_code = 200+ response.ok = True+ response.json.return_value = {+ "data": {object_name: {"nodes": [{"id": "1"}], "pageInfo": {"hasNextPage": False, "endCursor": None}}}+ }+ return response+++class TestRowFilterColumns:+ @pytest.mark.parametrize(+ "schema_name, expected",+ [+ (ORDERS, (CREATED_AT_COLUMN,)),+ (CUSTOMERS, (CREATED_AT_COLUMN,)),+ ("discountCodes", (CREATED_AT_COLUMN,)),+ (COLLECTIONS, ()),+ (BLOGS, ()),+ ],+ )+ def test_columns_by_schema(self, schema_name: str, expected: tuple[RowFilterColumn, ...]) -> None:+ assert ShopifySource().row_filter_columns_for_schema(schema_name) == expected+++class TestRowFilterSearchTerms:+ @pytest.mark.parametrize(+ "schema_name, row_filter, expected",+ [+ (+ ORDERS,+ _created_at_filter(">=", datetime(2024, 1, 1, tzinfo=UTC)),+ "created_at:>='2024-01-01T00:00:00+00:00'",+ ),+ # A value without a timezone is read as UTC.+ (ORDERS, _created_at_filter("<", datetime(2024, 1, 1)), "created_at:<'2024-01-01T00:00:00+00:00'"),+ (+ CUSTOMERS,+ _created_at_filter(">", datetime(2024, 1, 1, tzinfo=UTC)),+ "customer_date:>'2024-01-01T00:00:00+00:00'",+ ),+ ],+ )+ def test_term(self, schema_name: str, row_filter: ValidatedRowFilter, expected: str) -> None:+ assert row_filter_search_terms(schema_name, [row_filter]) == [expected]++ @pytest.mark.parametrize(+ "schema_name, row_filter",+ [+ (COLLECTIONS, _created_at_filter(">=", datetime(2024, 1, 1, tzinfo=UTC))),+ (+ ORDERS,+ ValidatedRowFilter(+ column="updated_at",+ operator=">=",+ value=datetime(2024, 1, 1, tzinfo=UTC),+ category=ColumnTypeCategory.TIMESTAMP,+ ),+ ),+ (+ ORDERS,+ ValidatedRowFilter(+ column="created_at",+ operator="=",+ value=datetime(2024, 1, 1, tzinfo=UTC),+ category=ColumnTypeCategory.TIMESTAMP,+ ),+ ),+ ],+ )+ def test_filter_without_a_search_term_raises(self, schema_name: str, row_filter: ValidatedRowFilter) -> None:+ with pytest.raises(ValueError, match="cannot apply the row filter"):+ row_filter_search_terms(schema_name, [row_filter])+++class TestShopifySourceQueries:+ @pytest.mark.parametrize(+ "incremental, last_value, earliest_value, expected_queries",+ [+ (False, None, None, ["created_at:>='2024-01-01T00:00:00+00:00'"]),+ (True, None, None, ["created_at:>='2024-01-01T00:00:00+00:00'"]),+ (+ True,+ "2026-01-10",+ "2026-01-01",+ [+ "updated_at:<'2026-01-01' AND created_at:>='2024-01-01T00:00:00+00:00'",+ "updated_at:>'2026-01-10' AND created_at:>='2024-01-01T00:00:00+00:00'",+ ],+ ),+ ],+ )+ def test_every_read_carries_the_filter(+ self, incremental: bool, last_value: str | None, earliest_value: str | None, expected_queries: list[str]+ ) -> None:+ manager = MagicMock()+ manager.can_resume.return_value = False+ queries: list[Any] = []++ with patch(+ "products.warehouse_sources.backend.temporal.data_imports.sources.shopify.shopify.requests.Session"+ ) as session_cls:++ def _post(url: str, json: dict[str, Any] | None = None, **kwargs: Any) -> MagicMock:+ queries.append((json or {}).get("variables", {}).get("query"))+ return _response(ORDERS)++ session_cls.return_value.post.side_effect = _post++ source = shopify_source(+ shopify_store_id="store",+ shopify_client_id=None,+ shopify_client_secret=None,+ shopify_access_token="shpat_test",+ graphql_object_name=ORDERS,+ db_incremental_field_last_value=last_value,+ db_incremental_field_earliest_value=earliest_value,+ logger=MagicMock(),+ resumable_source_manager=manager,+ should_use_incremental_field=incremental,+ row_filters=[_created_at_filter(">=", datetime(2024, 1, 1, tzinfo=UTC))],+ )+ list(source.items())++ assert queries == expected_queriesdiff --git a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.pyindex f62b58eb44e8..4adf2d2c3ceb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py+++ b/products/warehouse_sources/backend/temporal/data_imports/workflow_activities/import_data_sync.py@@ -578,8 +578,15 @@ async def _import_data_with_reporting(inputs: ImportDataActivityInputs, logger:# Re-validate against current metadata so a stale filter (dropped column, changed type)# fails here with an actionable message rather than emitting a broken query downstream.+ filterable_columns = (+ SourceRegistry.get_source(source_type).row_filter_columns_for_schema(schema.name)+ if schema.row_filters and SourceRegistry.is_registered(source_type)+ else None+ )try:- row_filters = validate_and_coerce_row_filters(schema.row_filters, schema.schema_metadata)+ row_filters = validate_and_coerce_row_filters(+ schema.row_filters, schema.schema_metadata, filterable_columns+ )except RowFilterValidationError as e:raise RowFilterValidationError(f"Row filter on schema '{schema.name}' no longer matches the current table schema ({e}). "diff --git a/products/warehouse_sources/backend/tests/api/test_external_data_schema.py b/products/warehouse_sources/backend/tests/api/test_external_data_schema.pyindex 5d681b44da7a..a10942320c31 100644--- a/products/warehouse_sources/backend/tests/api/test_external_data_schema.py+++ b/products/warehouse_sources/backend/tests/api/test_external_data_schema.py@@ -4655,6 +4655,44 @@ class TestExternalDataSchemaRowFilters(APIBaseTest):assert response.status_code == 400assert "not supported for this source type" in str(response.json())+ def _create_shopify_schema(self, name: str) -> ExternalDataSchema:+ source = ExternalDataSource.objects.create(+ team=self.team,+ source_type=ExternalDataSourceType.SHOPIFY,+ job_inputs={"shopify_store_id": "store", "auth_method": {"selection": "access_token"}},+ )+ return ExternalDataSchema.objects.create(name=name, team=self.team, source=source)++ @parameterized.expand(+ [+ ("declared_column", "orders", [{"column": "created_at", "operator": ">=", "value": "2024-01-01"}], 200),+ ("other_column", "orders", [{"column": "updated_at", "operator": ">=", "value": "2024-01-01"}], 400),+ ("other_operator", "orders", [{"column": "created_at", "operator": "!=", "value": "2024-01-01"}], 400),+ (+ "schema_without_columns",+ "collections",+ [{"column": "created_at", "operator": ">=", "value": "2024-01-01"}],+ 400,+ ),+ ]+ )+ def test_row_filters_limited_to_columns_the_source_declares(self, _name, schema_name, row_filters, expected):+ schema = self._create_shopify_schema(schema_name)+ response = self._patch(schema, row_filters)+ assert response.status_code == expected, response.json()+ schema.refresh_from_db()+ assert schema.row_filters == (row_filters if expected == 200 else None)++ def test_row_filter_columns_returned_in_serializer(self):+ shopify_schema = self._create_shopify_schema("orders")+ response = self.client.get(f"/api/environments/{self.team.pk}/external_data_schemas/{shopify_schema.id}/")+ assert response.json()["row_filter_columns"] == [+ {"name": "created_at", "data_type": "timestamp", "operators": [">", ">=", "<", "<="]}+ ]+ # A SQL source filters on any discovered column, which the API reports as null.+ response = self.client.get(f"/api/environments/{self.team.pk}/external_data_schemas/{self._create().id}/")+ assert response.json()["row_filter_columns"] is None+def test_row_filters_rejected_for_cdc_schema(self):source = ExternalDataSource.objects.create(team=self.team,diff --git a/products/warehouse_sources/backend/tests/api/test_external_data_source.py b/products/warehouse_sources/backend/tests/api/test_external_data_source.pyindex 57585b4e8797..5667708466ff 100644--- a/products/warehouse_sources/backend/tests/api/test_external_data_source.py+++ b/products/warehouse_sources/backend/tests/api/test_external_data_source.py@@ -3348,6 +3348,7 @@ class TestExternalDataSource(APIBaseTest):"incremental_sync_blocked": None,"enabled_columns": None,"row_filters": None,+ "row_filter_columns": None,"available_columns": [],"source_column_metadata_available": False,"source": None,diff --git a/products/warehouse_sources/frontend/generated/api.schemas.ts b/products/warehouse_sources/frontend/generated/api.schemas.tsindex 7a29eac74e04..efbce62d7a0b 100644--- a/products/warehouse_sources/frontend/generated/api.schemas.ts+++ b/products/warehouse_sources/frontend/generated/api.schemas.ts@@ -257,6 +257,15 @@ export const IncrementalSyncBlockedReasonEnumApi = {DuplicatePrimaryKey: 'duplicate_primary_key',} as const+export interface RowFilterColumnApi {+ /** Column name to use as `column` in a row filter. */+ name: string+ /** Column type, which decides the format of the filter value. */+ data_type: string+ /** Operators a row filter on this column may use. */+ operators: string[]+}+export interface ExternalDataSourceApiVersionDeprecationApi {/** The deprecated vendor API version this source is pinned to. */version: string@@ -421,6 +430,11 @@ export interface ExternalDataSchemaApi {* @nullable*/row_filters?: ExternalDataSchemaApiRowFiltersItem[] | null+ /**+ * Columns a row filter on this schema may use, with the operators each accepts. `null` means any column in `available_columns` with any operator, which is the case for SQL sources. A list means the source can filter on these columns only; an empty list means this schema accepts no row filter.+ * @nullable+ */+ readonly row_filter_columns: readonly RowFilterColumnApi[] | null/** Column metadata (name, data type, nullable) for this schema. For SQL sources this is the source-side schema discovered via `refresh_schemas`; for other sources (and once synced) it falls back to the synced table's columns. Empty only before the first successful sync/refresh. */readonly available_columns: readonly ExternalDataSchemaApiAvailableColumnsItem[]/** Whether exact source-side column metadata is available for safe source-query projection. */@@ -606,6 +620,11 @@ export interface PatchedExternalDataSchemaApi {* @nullable*/row_filters?: PatchedExternalDataSchemaApiRowFiltersItem[] | null+ /**+ * Columns a row filter on this schema may use, with the operators each accepts. `null` means any column in `available_columns` with any operator, which is the case for SQL sources. A list means the source can filter on these columns only; an empty list means this schema accepts no row filter.+ * @nullable+ */+ readonly row_filter_columns?: readonly RowFilterColumnApi[] | null/** Column metadata (name, data type, nullable) for this schema. For SQL sources this is the source-side schema discovered via `refresh_schemas`; for other sources (and once synced) it falls back to the synced table's columns. Empty only before the first successful sync/refresh. */readonly available_columns?: readonly PatchedExternalDataSchemaApiAvailableColumnsItem[]/** Whether exact source-side column metadata is available for safe source-query projection. */diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 1bc5fba6d7d1..b62c1980f3f2 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -46723,6 +46723,15 @@ export namespace Schemas {DuplicatePrimaryKey: 'duplicate_primary_key',} as const;+ export interface RowFilterColumn {+ /** Column name to use as `column` in a row filter. */+ name: string;+ /** Column type, which decides the format of the filter value. */+ data_type: string;+ /** Operators a row filter on this column may use. */+ operators: string[];+ }+export interface ExternalDataSourceApiVersionDeprecation {/** The deprecated vendor API version this source is pinned to. */version: string;@@ -46850,6 +46859,11 @@ export namespace Schemas {* @nullable*/row_filters?: ExternalDataSchemaRowFiltersItem[] | null;+ /**+ * Columns a row filter on this schema may use, with the operators each accepts. `null` means any column in `available_columns` with any operator, which is the case for SQL sources. A list means the source can filter on these columns only; an empty list means this schema accepts no row filter.+ * @nullable+ */+ readonly row_filter_columns: readonly RowFilterColumn[] | null;/** Column metadata (name, data type, nullable) for this schema. For SQL sources this is the source-side schema discovered via `refresh_schemas`; for other sources (and once synced) it falls back to the synced table's columns. Empty only before the first successful sync/refresh. */readonly available_columns: readonly ExternalDataSchemaAvailableColumnsItem[];/** Whether exact source-side column metadata is available for safe source-query projection. */@@ -78940,6 +78954,11 @@ export namespace Schemas {* @nullable*/row_filters?: PatchedExternalDataSchemaRowFiltersItem[] | null;+ /**+ * Columns a row filter on this schema may use, with the operators each accepts. `null` means any column in `available_columns` with any operator, which is the case for SQL sources. A list means the source can filter on these columns only; an empty list means this schema accepts no row filter.+ * @nullable+ */+ readonly row_filter_columns?: readonly RowFilterColumn[] | null;/** Column metadata (name, data type, nullable) for this schema. For SQL sources this is the source-side schema discovered via `refresh_schemas`; for other sources (and once synced) it falls back to the synced table's columns. Empty only before the first successful sync/refresh. */readonly available_columns?: readonly PatchedExternalDataSchemaAvailableColumnsItem[];/** Whether exact source-side column metadata is available for safe source-query projection. */