from marshmallow import Schema, fields class CrossAttributionPairsSchema(Schema): account_id = fields.Int(required=True) account_type = fields.Str(required=True) class QueryWithPermissionsSchema(Schema): # Element-level allow_none mirrors the pre-#1914 lenient SQL-template path: # get_permissions_filter() can produce label_ids=[None] for LabelProfiles # whose first ows-permissions resource is a Subaccount (vendor_id=None). # The permissions_filter.sql macro renders that as `labelid IN (NULL)` # which matches no rows under SQL NULL semantics โ€” i.e. no leak. permission_label_ids = fields.List(fields.Int(allow_none=True), allow_none=True) permission_artist_ids = fields.List(fields.Int(allow_none=True), allow_none=True) permission_subaccount_ids = fields.List( fields.Int(allow_none=True), allow_none=True ) permission_label_participant_ids = fields.List( fields.Int(allow_none=True), allow_none=True ) permission_product_ids = fields.List(fields.Int(allow_none=True), allow_none=True) permission_feed_ids = fields.List(fields.Int) transfer_product_ownership_enabled = fields.Boolean(load_default=False) # Toggled per-call for queries that read a widened ROLLUP table (one row # per ownership tuple) and need the full_access dedup. Default False for # DAILY queries and queries on ยง8.3b "collapsing" rollups (where the # rollup row has no per-row label_id/subaccount_id to dedup against). rollup_grain = fields.Boolean(load_default=False) # IN-17362 feature flag (insights_line_soundcloud_collection_as_active). # When True, the source_of_streams_reclassification macros move the # "Listener's Collection" bucket into Active for LINE Japan (1503) and # SoundCloud (1505); when False (default) the SOS templates emit the raw # streams_active / streams_collection columns unchanged. Read from the # render context by the macros (imported `with context`), so it must be a # field on every SOS query schema โ€” they all inherit it from here. line_soundcloud_collection_as_active_enabled = fields.Boolean(load_default=False) # GO-4885 feature flag (insights_published_max_available_date). When True, # templates that join the max-available-date view at query time read its # _PUBLISHED twin, which dbt re-points only after the full # upgrade_main_pipeline swap batch. The original view sits on the _DBT # staging table, so mid-run it reports the new max date ~40 minutes before # the streams/metrics tables swap โ€” every store looks lagged and the 1D # windows NULL out. When False (default) the rendered join is byte-identical # to before the flag existed. published_max_available_date_enabled = fields.Boolean(load_default=False)