From db596cefa88afccdbef105c1d663fe2427035cbd Mon Sep 17 00:00:00 2001 From: Tsung-Ju Lii Date: Thu, 14 Nov 2024 16:05:27 +0800 Subject: [PATCH] [sc-29858] Only update `dbt_model.compiled_sql` when `node.compile_completed_at` is defined (#1043) * [sc-29858] Only update `dbt_model.compiled_sql` when `node.compile_completed_at` is defined * mark generated stuff * mark schema as generated * fix test --- .gitattributes | 2 + .../cloud/discovery_api/generated/client.py | 2 + .../cloud/discovery_api/generated/enums.py | 1 + .../generated/get_job_run_models.py | 1 + .../generated/get_job_run_snapshots.py | 1 + .../dbt/cloud/discovery_api/queries.graphql | 2 + .../dbt/cloud/discovery_api/schema.graphql | 257 +++++++++++++++++- metaphor/dbt/cloud/parser/dbt_node_parser.py | 4 +- pyproject.toml | 2 +- .../get_job_run_models/jaffle_shop.json | 10 + .../london_bike_analysis.json | 6 + .../metaphor_subscriptions.json | 6 + .../london_bike_analysis.json | 1 + tests/dbt/cloud/test_dbt_test_parser.py | 1 + 14 files changed, 291 insertions(+), 5 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..4e7c6b19 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +/metaphor/dbt/cloud/discovery_api/generated/** linguist-generated +/metaphor/dbt/cloud/discovery_api/schema.graphql linguist-generated diff --git a/metaphor/dbt/cloud/discovery_api/generated/client.py b/metaphor/dbt/cloud/discovery_api/generated/client.py index f393af0a..19fbfaec 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/client.py +++ b/metaphor/dbt/cloud/discovery_api/generated/client.py @@ -38,6 +38,7 @@ def get_job_run_models( tags type } + compileCompletedAt compiledCode compiledSql database @@ -88,6 +89,7 @@ def get_job_run_snapshots( type } comment + compileCompletedAt compiledCode compiledSql database diff --git a/metaphor/dbt/cloud/discovery_api/generated/enums.py b/metaphor/dbt/cloud/discovery_api/generated/enums.py index 836470d7..345c6424 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/enums.py +++ b/metaphor/dbt/cloud/discovery_api/generated/enums.py @@ -55,6 +55,7 @@ class ResourceNodeType(str, Enum): Macro = "Macro" Metric = "Metric" Model = "Model" + SavedQuery = "SavedQuery" Seed = "Seed" SemanticModel = "SemanticModel" Snapshot = "Snapshot" diff --git a/metaphor/dbt/cloud/discovery_api/generated/get_job_run_models.py b/metaphor/dbt/cloud/discovery_api/generated/get_job_run_models.py index 80e7eff8..74ee954f 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/get_job_run_models.py +++ b/metaphor/dbt/cloud/discovery_api/generated/get_job_run_models.py @@ -19,6 +19,7 @@ class GetJobRunModelsJob(BaseModel): class GetJobRunModelsJobModels(BaseModel): alias: Optional[str] columns: Optional[List["GetJobRunModelsJobModelsColumns"]] + compile_completed_at: Optional[Any] = Field(alias="compileCompletedAt") compiled_code: Optional[str] = Field(alias="compiledCode") compiled_sql: Optional[str] = Field(alias="compiledSql") database: Optional[str] diff --git a/metaphor/dbt/cloud/discovery_api/generated/get_job_run_snapshots.py b/metaphor/dbt/cloud/discovery_api/generated/get_job_run_snapshots.py index 0d5d7acc..9d1abae4 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/get_job_run_snapshots.py +++ b/metaphor/dbt/cloud/discovery_api/generated/get_job_run_snapshots.py @@ -20,6 +20,7 @@ class GetJobRunSnapshotsJobSnapshots(BaseModel): alias: Optional[str] columns: Optional[List["GetJobRunSnapshotsJobSnapshotsColumns"]] comment: Optional[str] + compile_completed_at: Optional[Any] = Field(alias="compileCompletedAt") compiled_code: Optional[str] = Field(alias="compiledCode") compiled_sql: Optional[str] = Field(alias="compiledSql") database: Optional[str] diff --git a/metaphor/dbt/cloud/discovery_api/queries.graphql b/metaphor/dbt/cloud/discovery_api/queries.graphql index ca2574ca..073e1dc8 100644 --- a/metaphor/dbt/cloud/discovery_api/queries.graphql +++ b/metaphor/dbt/cloud/discovery_api/queries.graphql @@ -10,6 +10,7 @@ query GetJobRunModels($jobId: BigInt!, $runId: BigInt!) { tags type } + compileCompletedAt compiledCode compiledSql database @@ -47,6 +48,7 @@ query GetJobRunSnapshots($jobId: BigInt!, $runId: BigInt!) { type } comment + compileCompletedAt compiledCode compiledSql database diff --git a/metaphor/dbt/cloud/discovery_api/schema.graphql b/metaphor/dbt/cloud/discovery_api/schema.graphql index 79fe8d25..0188b31a 100644 --- a/metaphor/dbt/cloud/discovery_api/schema.graphql +++ b/metaphor/dbt/cloud/discovery_api/schema.graphql @@ -401,6 +401,13 @@ type DefinitionState { filter: DefinitionResourcesFilter! first: Int ): EnvironmentDefinitionNodeConnection! + savedQueries( + after: String + + """SavedQuerys Filter""" + filter: GenericMaterializedFilter + first: Int + ): SavedQueryDefinitionNodeConnection! seeds( after: String @@ -1216,7 +1223,7 @@ type JobNode { seeds: [SeedNode!]! snapshot(uniqueId: String!): SnapshotNode - """Retrieve model information.""" + """Retrieve snapshot information.""" snapshots: [SnapshotNode!]! source(uniqueId: String!): SourceNode @@ -2242,6 +2249,9 @@ type ModelAppliedStateNode implements EnvironmentAppliedNode { """The group this model belongs to""" group: String + """Whether the description is inherited from a catalog comment""" + isDescriptionInherited: Boolean + """The language of this model""" language: String @@ -2567,7 +2577,7 @@ type ModelExecutionInfoNode { lastRunId: BigInt """ - The status of the last run that either succeeded or failed in building this model + The build status of this model that either succeeded or failed in the last run """ lastRunStatus: RunStatus @@ -3080,6 +3090,55 @@ type Query { ): [TestNode!]! @deprecated(reason: "We recommend using the environment query to get the latest state instead.") } +type QueryExportConfig { + """The alias of the export""" + alias: String + + """The database of the export""" + database: String + + """The type of export to run""" + exportAs: String! + + """The schema of the export""" + schema: String +} + +type QueryExports { + """The config of the export""" + config: QueryExportConfig + + """The name of the query export""" + name: String +} + +type QueryParams { + """The group by of the query params""" + groupBy: [String!]! + + """The limit of the query params""" + limit: BigInt + + """The metrics of the query params""" + metrics: [String!]! + + """The order by of the query params""" + orderBy: [String] + + """The where of the query params""" + where: QueryWhere +} + +type QueryWhere { + """The where filters of the query params""" + whereFilters: [QueryWhereFilter!]! +} + +type QueryWhereFilter { + """The sql template of the where""" + whereSqlTemplate: String! +} + enum ReleaseVersion { latest none @@ -3093,6 +3152,7 @@ enum ResourceNodeType { Macro Metric Model + SavedQuery Seed SemanticModel Snapshot @@ -3146,13 +3206,204 @@ type RunInfoNode { threadId: String } -"""Status of a run""" +"""Status of a run or a resource's build status in a run""" enum RunStatus { error skipped success } +type SavedQueryDefinitionNestedNode implements EnvironmentAppliedNestedNode & EnvironmentDefinitionNestedNode { + """dbt version""" + dbtVersion: String + + """The user-supplied description for this node""" + description: String + + """The exports of this saved query""" + exports: [QueryExports!]! + + """Original file path to the node""" + filePath: String! + + """The fully qualified name of the node""" + fqn: [String!] + + """The group this saved query belongs to""" + group: String + + """ + The job ID of the last run containing definition of this saved query node + """ + jobDefinitionId: BigInt + + """The user-supplied name of this particular node""" + name: String + + """The package name of this saved query""" + packageName: String + + """The query params of the metric""" + queryParams: QueryParams! + + """The resource type of this node""" + resourceType: String! + + """ + The timestamp when the run step (dbt run) was completed, ISO formatted timestamp + """ + runGeneratedAt: DateTime + + """ + The run ID of the last run containing definition of this saved query node + """ + runId: BigInt + + """The unique ID of this node""" + uniqueId: String! +} + +type SavedQueryDefinitionNode implements EnvironmentAppliedNode & EnvironmentDefinitionNode { + """The account ID of this node""" + accountId: BigInt! + + """The ancestors of this saved query""" + ancestors: [EnvironmentDefinitionNestedNode!]! + + """The direct children of this saved query""" + children: [EnvironmentDefinitionNestedNode!]! + + """dbt version""" + dbtVersion: String + + """The user-supplied description for this node""" + description: String + + """The environment ID of this node""" + environmentId: BigInt! + + """The exports of this saved query""" + exports: [QueryExports!]! + + """Original file path to the node""" + filePath: String! + + """The fully qualified name of this saved query""" + fqn: [String!]! + + """The group this saved query belongs to""" + group: String + + """ + The job ID of the last run containing definition of this saved query node + """ + jobDefinitionId: BigInt + + """The key-value store containing metadata relevant to this node""" + meta: JSONObject + + """The user-supplied name of this particular node""" + name: String + + """The package name of this saved query""" + packageName: String + + """The direct parents of this saved query""" + parents: [EnvironmentDefinitionNestedNode!]! + + """The project ID of this node""" + projectId: BigInt! + + """The query params of the metric""" + queryParams: QueryParams! + + """The resource type of this node""" + resourceType: String! + + """ + The timestamp when the run step (dbt run) was completed, ISO formatted timestamp + """ + runGeneratedAt: DateTime + + """ + The run ID of the last run containing definition of this saved query node + """ + runId: BigInt + + """The tags associated with this node""" + tags: [String!]! + + """The unique ID of this node""" + uniqueId: String! +} + +type SavedQueryDefinitionNodeConnection { + edges: [SavedQueryDefinitionNodeEdge!]! + pageInfo: PageInfo! + totalCount: Int! +} + +type SavedQueryDefinitionNodeEdge { + cursor: String! + node: SavedQueryDefinitionNode! +} + +"""SavedQuery Lineage Object""" +type SavedQueryLineageNode implements LineageGraphNode & LineageNode & LineageNodeWithParents { + """The access level of this node""" + access: String @deprecated(reason: "Use ...on syntax from specific types") + + """The package alias of this node""" + alias: String @deprecated(reason: "Use ...on syntax from specific types") + + """The package database of this node""" + database: String @deprecated(reason: "Use ...on syntax from specific types") + + """Original file path to the node""" + filePath: String! + + """The fully qualified name of this node""" + fqn: [String!]! + + """The group this node belongs to""" + group: String @deprecated(reason: "Use ...on syntax from specific types") + + """ + True if the node matches a selector method, rather than matching via graph traversal + """ + matchesMethod: Boolean + + """The materialization type""" + materializationType: String @deprecated(reason: "Use ...on syntax from specific types") + + """The user-supplied name of this particular node""" + name: String + + """the nodes this node depends on""" + parentIds: [String!]! @deprecated(reason: "Use ...on syntax from specific types") + + """The project id of this node""" + projectId: BigInt! + + """the public nodes this resource depends on""" + publicParentIds: [String!]! @deprecated(reason: "Use ...on syntax from specific types") + + """The resource type of this node""" + resourceType: ResourceNodeType! + + """The package schema of this node""" + schema: String @deprecated(reason: "Use ...on syntax from specific types") + + """The tags associated with this node""" + tags: [String!]! + + """The unique ID of this node""" + uniqueId: String! + + """The version of this node""" + version: String @deprecated(reason: "Use ...on syntax from specific types") +} + type SeedAppliedStateNestedNode implements EnvironmentAppliedNestedNode { """The package alias of this seed""" alias: String diff --git a/metaphor/dbt/cloud/parser/dbt_node_parser.py b/metaphor/dbt/cloud/parser/dbt_node_parser.py index 437f8c8a..74fa6ccf 100644 --- a/metaphor/dbt/cloud/parser/dbt_node_parser.py +++ b/metaphor/dbt/cloud/parser/dbt_node_parser.py @@ -274,7 +274,9 @@ def parse( # raw_sql & complied_sql got renamed to raw_code & complied_code in V7 dbt_model.raw_sql = node.raw_code or node.raw_sql - dbt_model.compiled_sql = node.compiled_code or node.compiled_sql + # Only update compiled sql if compilation actually completed + if node.compile_completed_at is not None: + dbt_model.compiled_sql = node.compiled_code or node.compiled_sql self._parse_model_materialization(node, dbt_model) diff --git a/pyproject.toml b/pyproject.toml index 9b4bed60..bc08a5b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "metaphor-connectors" -version = "0.14.156" +version = "0.14.157" license = "Apache-2.0" description = "A collection of Python-based 'connectors' that extract metadata from various sources to ingest into the Metaphor app." authors = ["Metaphor "] diff --git a/tests/dbt/cloud/fake_graphql_server/get_job_run_models/jaffle_shop.json b/tests/dbt/cloud/fake_graphql_server/get_job_run_models/jaffle_shop.json index 960207fa..922e2a87 100644 --- a/tests/dbt/cloud/fake_graphql_server/get_job_run_models/jaffle_shop.json +++ b/tests/dbt/cloud/fake_graphql_server/get_job_run_models/jaffle_shop.json @@ -69,6 +69,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "\\n\\nwith\\n\\ncustomers as (\\n\\n select * from acme.jaffle_shop.stg_customers\\n\\n),\\n\\norders_mart as (\\n\\n select * from acme.jaffle_shop.orders\\n\\n),\\n\\norder_items_mart as (\\n\\n select * from acme.jaffle_shop.order_items\\n),\\n\\norder_summary as (\\n\\n select\\n customer_id,\\n\\n count(distinct om.order_id) as count_lifetime_orders,\\n count(distinct om.order_id) > 1 as is_repeat_buyer,\\n min(om.ordered_at) as first_ordered_at,\\n max(om.ordered_at) as last_ordered_at,\\n sum(oi.subtotal) as lifetime_spend_pretax,\\n sum(om.order_total) as lifetime_spend\\n\\n from orders_mart om\\n \\n left join order_items_mart oi on om.order_id = oi.order_id\\n \\n group by 1\\n\\n),\\n\\njoined as (\\n\\n select\\n customers.*,\\n order_summary.count_lifetime_orders,\\n order_summary.first_ordered_at,\\n order_summary.last_ordered_at,\\n order_summary.lifetime_spend_pretax,\\n order_summary.lifetime_spend,\\n\\n case\\n when order_summary.is_repeat_buyer then 'returning'\\n else 'new'\\n end as customer_type\\n\\n from customers\\n\\n left join order_summary\\n on customers.customer_id = order_summary.customer_id\\n\\n)\\n\\nselect * from joined", "compiledSql": "\\n\\nwith\\n\\ncustomers as (\\n\\n select * from acme.jaffle_shop.stg_customers\\n\\n),\\n\\norders_mart as (\\n\\n select * from acme.jaffle_shop.orders\\n\\n),\\n\\norder_items_mart as (\\n\\n select * from acme.jaffle_shop.order_items\\n),\\n\\norder_summary as (\\n\\n select\\n customer_id,\\n\\n count(distinct om.order_id) as count_lifetime_orders,\\n count(distinct om.order_id) > 1 as is_repeat_buyer,\\n min(om.ordered_at) as first_ordered_at,\\n max(om.ordered_at) as last_ordered_at,\\n sum(oi.subtotal) as lifetime_spend_pretax,\\n sum(om.order_total) as lifetime_spend\\n\\n from orders_mart om\\n \\n left join order_items_mart oi on om.order_id = oi.order_id\\n \\n group by 1\\n\\n),\\n\\njoined as (\\n\\n select\\n customers.*,\\n order_summary.count_lifetime_orders,\\n order_summary.first_ordered_at,\\n order_summary.last_ordered_at,\\n order_summary.lifetime_spend_pretax,\\n order_summary.lifetime_spend,\\n\\n case\\n when order_summary.is_repeat_buyer then 'returning'\\n else 'new'\\n end as customer_type\\n\\n from customers\\n\\n left join order_summary\\n on customers.customer_id = order_summary.customer_id\\n\\n)\\n\\nselect * from joined", "database": "acme", @@ -111,6 +112,7 @@ "type": "DATE" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "-- metricflow_time_spine.sql\\nwith days as (\\n --for BQ adapters use \"DATE('01/01/2000','mm/dd/yyyy')\"\\n\\n with date_spine as\\n(\\n\\n \\n\\n\\n\\n\\n\\nwith rawdata as (\\n\\n \\n\\n \\n\\n with p as (\\n select 0 as generated_number union all select 1\\n ), unioned as (\\n\\n select\\n\\n \\n p0.generated_number * power(2, 0)\\n + \\n \\n p1.generated_number * power(2, 1)\\n + \\n \\n p2.generated_number * power(2, 2)\\n + \\n \\n p3.generated_number * power(2, 3)\\n + \\n \\n p4.generated_number * power(2, 4)\\n + \\n \\n p5.generated_number * power(2, 5)\\n + \\n \\n p6.generated_number * power(2, 6)\\n + \\n \\n p7.generated_number * power(2, 7)\\n + \\n \\n p8.generated_number * power(2, 8)\\n + \\n \\n p9.generated_number * power(2, 9)\\n + \\n \\n p10.generated_number * power(2, 10)\\n + \\n \\n p11.generated_number * power(2, 11)\\n \\n \\n + 1\\n as generated_number\\n\\n from\\n\\n \\n p as p0\\n cross join \\n \\n p as p1\\n cross join \\n \\n p as p2\\n cross join \\n \\n p as p3\\n cross join \\n \\n p as p4\\n cross join \\n \\n p as p5\\n cross join \\n \\n p as p6\\n cross join \\n \\n p as p7\\n cross join \\n \\n p as p8\\n cross join \\n \\n p as p9\\n cross join \\n \\n p as p10\\n cross join \\n \\n p as p11\\n \\n \\n\\n )\\n\\n select *\\n from unioned\\n where generated_number <= 3651\\n order by generated_number\\n\\n\\n\\n),\\n\\nall_periods as (\\n\\n select (\\n \\n\\n dateadd(\\n day,\\n row_number() over (order by 1) - 1,\\n \\n\\n dateadd(\\n day,\\n -3650,\\n cast(convert_timezone('UTC', 'America/Los_Angeles',\\n cast(convert_timezone('UTC', current_timestamp()) as timestamp)\\n) as date)\\n )\\n\\n\\n )\\n\\n\\n ) as date_day\\n from rawdata\\n\\n),\\n\\nfiltered as (\\n\\n select *\\n from all_periods\\n where date_day <= cast(\\n\\n dateadd(\\n day,\\n 1,\\n cast(convert_timezone('UTC', 'America/Los_Angeles',\\n cast(convert_timezone('UTC', current_timestamp()) as timestamp)\\n) as date)\\n )\\n\\n as date)\\n\\n)\\n\\nselect * from filtered\\n\\n\\n\\n)\\nselect\\n cast(d.date_day as timestamp) as date_day\\nfrom\\n date_spine d\\n\\n\\n),\\n\\nfinal as (\\n select cast(date_day as date) as date_day\\n from days\\n)\\n\\nselect *\\nfrom final", "compiledSql": "-- metricflow_time_spine.sql\\nwith days as (\\n --for BQ adapters use \"DATE('01/01/2000','mm/dd/yyyy')\"\\n\\n with date_spine as\\n(\\n\\n \\n\\n\\n\\n\\n\\nwith rawdata as (\\n\\n \\n\\n \\n\\n with p as (\\n select 0 as generated_number union all select 1\\n ), unioned as (\\n\\n select\\n\\n \\n p0.generated_number * power(2, 0)\\n + \\n \\n p1.generated_number * power(2, 1)\\n + \\n \\n p2.generated_number * power(2, 2)\\n + \\n \\n p3.generated_number * power(2, 3)\\n + \\n \\n p4.generated_number * power(2, 4)\\n + \\n \\n p5.generated_number * power(2, 5)\\n + \\n \\n p6.generated_number * power(2, 6)\\n + \\n \\n p7.generated_number * power(2, 7)\\n + \\n \\n p8.generated_number * power(2, 8)\\n + \\n \\n p9.generated_number * power(2, 9)\\n + \\n \\n p10.generated_number * power(2, 10)\\n + \\n \\n p11.generated_number * power(2, 11)\\n \\n \\n + 1\\n as generated_number\\n\\n from\\n\\n \\n p as p0\\n cross join \\n \\n p as p1\\n cross join \\n \\n p as p2\\n cross join \\n \\n p as p3\\n cross join \\n \\n p as p4\\n cross join \\n \\n p as p5\\n cross join \\n \\n p as p6\\n cross join \\n \\n p as p7\\n cross join \\n \\n p as p8\\n cross join \\n \\n p as p9\\n cross join \\n \\n p as p10\\n cross join \\n \\n p as p11\\n \\n \\n\\n )\\n\\n select *\\n from unioned\\n where generated_number <= 3651\\n order by generated_number\\n\\n\\n\\n),\\n\\nall_periods as (\\n\\n select (\\n \\n\\n dateadd(\\n day,\\n row_number() over (order by 1) - 1,\\n \\n\\n dateadd(\\n day,\\n -3650,\\n cast(convert_timezone('UTC', 'America/Los_Angeles',\\n cast(convert_timezone('UTC', current_timestamp()) as timestamp)\\n) as date)\\n )\\n\\n\\n )\\n\\n\\n ) as date_day\\n from rawdata\\n\\n),\\n\\nfiltered as (\\n\\n select *\\n from all_periods\\n where date_day <= cast(\\n\\n dateadd(\\n day,\\n 1,\\n cast(convert_timezone('UTC', 'America/Los_Angeles',\\n cast(convert_timezone('UTC', current_timestamp()) as timestamp)\\n) as date)\\n )\\n\\n as date)\\n\\n)\\n\\nselect * from filtered\\n\\n\\n\\n)\\nselect\\n cast(d.date_day as timestamp) as date_day\\nfrom\\n date_spine d\\n\\n\\n),\\n\\nfinal as (\\n select cast(date_day as date) as date_day\\n from days\\n)\\n\\nselect *\\nfrom final", "database": "acme", @@ -199,6 +201,7 @@ "type": "NUMBER" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "\\n\\nwith order_items as (\\n\\n select * from acme.jaffle_shop.stg_order_items\\n\\n),\\n\\n\\norders as (\\n \\n select * from acme.jaffle_shop.stg_orders\\n),\\n\\nproducts as (\\n\\n select * from acme.jaffle_shop.stg_products\\n\\n),\\n\\n\\nfinal as (\\n select\\n order_items.*,\\n orders.ordered_at,\\n products.product_price as subtotal,\\n products.is_food_item,\\n products.is_drink_item\\n from order_items\\n\\n left join products on order_items.product_id = products.product_id\\n -- left join order_supplies_summary on order_items.order_id = order_supplies_summary.product_id\\n left join orders on order_items.order_id = orders.order_id\\n)\\n\\nselect * from final", "compiledSql": "\\n\\nwith order_items as (\\n\\n select * from acme.jaffle_shop.stg_order_items\\n\\n),\\n\\n\\norders as (\\n \\n select * from acme.jaffle_shop.stg_orders\\n),\\n\\nproducts as (\\n\\n select * from acme.jaffle_shop.stg_products\\n\\n),\\n\\n\\nfinal as (\\n select\\n order_items.*,\\n orders.ordered_at,\\n products.product_price as subtotal,\\n products.is_food_item,\\n products.is_drink_item\\n from order_items\\n\\n left join products on order_items.product_id = products.product_id\\n -- left join order_supplies_summary on order_items.order_id = order_supplies_summary.product_id\\n left join orders on order_items.order_id = orders.order_id\\n)\\n\\nselect * from final", "database": "acme", @@ -305,6 +308,7 @@ "type": "NUMBER" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "\\n\\n\\nwith orders as (\\n \\n select * from acme.jaffle_shop.stg_orders\\n\\n),\\n\\norder_items as (\\n \\n select * from acme.jaffle_shop.stg_order_items\\n\\n),\\n\\nproducts as (\\n\\n select * from acme.jaffle_shop.stg_products\\n),\\n\\nsupplies as (\\n\\n select * from acme.jaffle_shop.stg_supplies\\n\\n),\\n\\n\\norder_items_summary as (\\n\\n select\\n\\n order_items.order_id,\\n\\n sum(supplies.supply_cost) as order_cost,\\n sum(is_food_item) as count_food_items,\\n sum(is_drink_item) as count_drink_items\\n\\n\\n from order_items\\n\\n left join supplies on order_items.product_id = supplies.product_id\\n left join products on order_items.product_id = products.product_id\\n\\n group by 1\\n\\n),\\n\\n\\nfinal as (\\n select\\n\\n orders.*,\\n count_food_items > 0 as is_food_order,\\n count_drink_items > 0 as is_drink_order,\\n order_cost\\n\\n from orders\\n \\n left join order_items_summary on orders.order_id = order_items_summary.order_id\\n)\\n\\nselect * from final", "compiledSql": "\\n\\n\\nwith orders as (\\n \\n select * from acme.jaffle_shop.stg_orders\\n\\n),\\n\\norder_items as (\\n \\n select * from acme.jaffle_shop.stg_order_items\\n\\n),\\n\\nproducts as (\\n\\n select * from acme.jaffle_shop.stg_products\\n),\\n\\nsupplies as (\\n\\n select * from acme.jaffle_shop.stg_supplies\\n\\n),\\n\\n\\norder_items_summary as (\\n\\n select\\n\\n order_items.order_id,\\n\\n sum(supplies.supply_cost) as order_cost,\\n sum(is_food_item) as count_food_items,\\n sum(is_drink_item) as count_drink_items\\n\\n\\n from order_items\\n\\n left join supplies on order_items.product_id = supplies.product_id\\n left join products on order_items.product_id = products.product_id\\n\\n group by 1\\n\\n),\\n\\n\\nfinal as (\\n select\\n\\n orders.*,\\n count_food_items > 0 as is_food_order,\\n count_drink_items > 0 as is_drink_order,\\n order_cost\\n\\n from orders\\n \\n left join order_items_summary on orders.order_id = order_items_summary.order_id\\n)\\n\\nselect * from final", "database": "acme", @@ -356,6 +360,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "with\\n\\nsource as (\\n\\n select * from raw_customers\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as customer_id,\\n\\n ---------- properties\\n name as customer_name\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "compiledSql": "with\\n\\nsource as (\\n\\n select * from raw_customers\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as customer_id,\\n\\n ---------- properties\\n name as customer_name\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "database": "acme", @@ -418,6 +423,7 @@ "type": "TIMESTAMP_NTZ" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "with\\n\\nsource as (\\n\\n select * from raw_stores\\n\\n -- \\n -- where opened_at <= convert_timezone('UTC', current_timestamp())\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as location_id,\\n\\n ---------- properties\\n name as location_name,\\n tax_rate,\\n\\n ---------- timestamp\\n opened_at\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "compiledSql": "with\\n\\nsource as (\\n\\n select * from raw_stores\\n\\n -- \\n -- where opened_at <= convert_timezone('UTC', current_timestamp())\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as location_id,\\n\\n ---------- properties\\n name as location_name,\\n tax_rate,\\n\\n ---------- timestamp\\n opened_at\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "database": "acme", @@ -474,6 +480,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "with\\n\\nsource as (\\n\\n select * from raw_items\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as order_item_id,\\n order_id,\\n\\n ---------- properties\\n sku as product_id\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "compiledSql": "with\\n\\nsource as (\\n\\n select * from raw_items\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as order_item_id,\\n order_id,\\n\\n ---------- properties\\n sku as product_id\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "database": "acme", @@ -552,6 +559,7 @@ "type": "TIMESTAMP_NTZ" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "\\n\\nwith\\n\\nsource as (\\n\\n select * from raw_orders\\n\\n -- data runs to 2026, truncate timespan to desired range,\\n -- current time as default\\n -- where ordered_at <= convert_timezone('UTC', current_timestamp())\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as order_id,\\n store_id as location_id,\\n customer as customer_id,\\n\\n ---------- properties\\n (order_total / 100.0) as order_total,\\n (tax_paid / 100.0) as tax_paid,\\n\\n ---------- timestamps\\n ordered_at\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "compiledSql": "\\n\\nwith\\n\\nsource as (\\n\\n select * from raw_orders\\n\\n -- data runs to 2026, truncate timespan to desired range,\\n -- current time as default\\n -- where ordered_at <= convert_timezone('UTC', current_timestamp())\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n id as order_id,\\n store_id as location_id,\\n customer as customer_id,\\n\\n ---------- properties\\n (order_total / 100.0) as order_total,\\n (tax_paid / 100.0) as tax_paid,\\n\\n ---------- timestamps\\n ordered_at\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "database": "acme", @@ -640,6 +648,7 @@ "type": "NUMBER" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "with\\n\\nsource as (\\n\\n select * from raw_products\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n sku as product_id,\\n\\n ---------- properties\\n name as product_name,\\n type as product_type,\\n description as product_description,\\n (price / 100.0) as product_price,\\n\\n\\n ---------- derived\\n case\\n when type = 'jaffle' then 1\\n else 0\\n end as is_food_item,\\n\\n case\\n when type = 'beverage' then 1\\n else 0\\n end as is_drink_item\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "compiledSql": "with\\n\\nsource as (\\n\\n select * from raw_products\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n sku as product_id,\\n\\n ---------- properties\\n name as product_name,\\n type as product_type,\\n description as product_description,\\n (price / 100.0) as product_price,\\n\\n\\n ---------- derived\\n case\\n when type = 'jaffle' then 1\\n else 0\\n end as is_food_item,\\n\\n case\\n when type = 'beverage' then 1\\n else 0\\n end as is_drink_item\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "database": "acme", @@ -718,6 +727,7 @@ "type": "BOOLEAN" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "with\\n\\nsource as (\\n\\n select * from raw_supplies\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n \\n \\nmd5(cast(coalesce(cast(id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(sku as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as supply_uuid,\\n id as supply_id,\\n sku as product_id,\\n\\n ---------- properties\\n name as supply_name,\\n (cost / 100.0) as supply_cost,\\n perishable as is_perishable_supply\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "compiledSql": "with\\n\\nsource as (\\n\\n select * from raw_supplies\\n\\n),\\n\\nrenamed as (\\n\\n select\\n\\n ---------- ids\\n \\n \\nmd5(cast(coalesce(cast(id as TEXT), '_dbt_utils_surrogate_key_null_') || '-' || coalesce(cast(sku as TEXT), '_dbt_utils_surrogate_key_null_') as TEXT)) as supply_uuid,\\n id as supply_id,\\n sku as product_id,\\n\\n ---------- properties\\n name as supply_name,\\n (cost / 100.0) as supply_cost,\\n perishable as is_perishable_supply\\n\\n from source\\n\\n)\\n\\nselect * from renamed", "database": "acme", diff --git a/tests/dbt/cloud/fake_graphql_server/get_job_run_models/london_bike_analysis.json b/tests/dbt/cloud/fake_graphql_server/get_job_run_models/london_bike_analysis.json index d0153188..bd61017a 100644 --- a/tests/dbt/cloud/fake_graphql_server/get_job_run_models/london_bike_analysis.json +++ b/tests/dbt/cloud/fake_graphql_server/get_job_run_models/london_bike_analysis.json @@ -89,6 +89,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "-- Adding extra fields including if the bike was rented during peak time \nSELECT\n SUM(duration_minutes) as total_minutes\n , COUNT(rental_id) as total_bike_hires\n , ROUND(SUM(duration_minutes) / COUNT(rental_id), 2) AS average_duration\n , EXTRACT(month from start_date) as month\n , CASE\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 6 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 10 THEN 'Morning Peak'\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 16 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 19 THEN 'Evening Peak'\n ELSE 'Off-Peak'\n END AS start_peak_travel\n , IFF(start_station_id = end_station_id, True, False) as same_station_flag\n , start_station_id\n , start_station_name\n , end_station_id\n , end_station_name\nFROM ACME.ride_share.raw_bike_hires\nGROUP BY 4,5,6,7,8,9,10\nORDER BY total_minutes DESC", "compiledSql": "-- Adding extra fields including if the bike was rented during peak time \nSELECT\n SUM(duration_minutes) as total_minutes\n , COUNT(rental_id) as total_bike_hires\n , ROUND(SUM(duration_minutes) / COUNT(rental_id), 2) AS average_duration\n , EXTRACT(month from start_date) as month\n , CASE\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 6 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 10 THEN 'Morning Peak'\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 16 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 19 THEN 'Evening Peak'\n ELSE 'Off-Peak'\n END AS start_peak_travel\n , IFF(start_station_id = end_station_id, True, False) as same_station_flag\n , start_station_id\n , start_station_name\n , end_station_id\n , end_station_name\nFROM ACME.ride_share.raw_bike_hires\nGROUP BY 4,5,6,7,8,9,10\nORDER BY total_minutes DESC", "database": "ACME", @@ -206,6 +207,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "-- Adding extra fields including if the bike was rented during peak time \nSELECT\n SUM(duration) as total_seconds\n , COUNT(rental_id) as total_bike_hires\n , ROUND(SUM(duration) / COUNT(rental_id), 2) AS average_duration\n , EXTRACT(month from start_date) as month\n , CASE\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 6 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 10 THEN 'Morning Peak'\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 16 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 19 THEN 'Evening Peak'\n ELSE 'Off-Peak'\n END AS start_peak_travel\n , IFF(start_station_id = end_station_id, True, False) as same_station_flag\n , start_station_id\n , start_station_name\n , end_station_id\n , end_station_name\nFROM ACME.snapshots.cycle_hire_snapshot\nGROUP BY 4,5,6,7,8,9,10\nORDER BY total_seconds DESC", "compiledSql": "-- Adding extra fields including if the bike was rented during peak time \nSELECT\n SUM(duration) as total_seconds\n , COUNT(rental_id) as total_bike_hires\n , ROUND(SUM(duration) / COUNT(rental_id), 2) AS average_duration\n , EXTRACT(month from start_date) as month\n , CASE\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 6 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 10 THEN 'Morning Peak'\n WHEN EXTRACT(HOUR from TO_TIMESTAMP(start_date)) >= 16 AND EXTRACT(HOUR from TO_TIMESTAMP(start_date)) <= 19 THEN 'Evening Peak'\n ELSE 'Off-Peak'\n END AS start_peak_travel\n , IFF(start_station_id = end_station_id, True, False) as same_station_flag\n , start_station_id\n , start_station_name\n , end_station_id\n , end_station_name\nFROM ACME.snapshots.cycle_hire_snapshot\nGROUP BY 4,5,6,7,8,9,10\nORDER BY total_seconds DESC", "database": "ACME", @@ -314,6 +316,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "SELECT \n rental_id\n , duration as duration_seconds\n , duration / 60 as duration_minutes\n , bike_id\n , start_date\n , start_station_id\n , start_station_name\n , end_date\n , end_station_id\n , end_station_name\nFROM ACME.berlin_bicycles.cycle_hire\nWHERE EXTRACT(year from start_date) = 2017", "compiledSql": "SELECT \n rental_id\n , duration as duration_seconds\n , duration / 60 as duration_minutes\n , bike_id\n , start_date\n , start_station_id\n , start_station_name\n , end_date\n , end_station_id\n , end_station_name\nFROM ACME.berlin_bicycles.cycle_hire\nWHERE EXTRACT(year from start_date) = 2017", "database": "ACME", @@ -390,6 +393,7 @@ "type": "DATE" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "SELECT \n id\n , name as station_name\n , bikes_count\n , docks_count\n , install_date\n , removal_date\nFROM ACME.berlin_bicycles.cycle_stations\nWHERE install_date < '2017-01-01' and (removal_date < '2018-01-01' or removal_date is null)", "compiledSql": "SELECT \n id\n , name as station_name\n , bikes_count\n , docks_count\n , install_date\n , removal_date\nFROM ACME.berlin_bicycles.cycle_stations\nWHERE install_date < '2017-01-01' and (removal_date < '2018-01-01' or removal_date is null)", "database": "ACME", @@ -546,6 +550,7 @@ "type": "DATE" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "WITH stations AS (\n\n SELECT *\n FROM ACME.ride_share.raw_bike_stations\n\n),\n\nrides AS (\n\n SELECT *\n FROM ACME.ride_share.cleaned_bike_rides\n\n),\n\nstart_stat_join AS (\n\n SELECT rides.*\n , stations.bikes_count as start_station_bikes_count\n , stations.docks_count as start_station_docks_count\n , stations.install_date as start_station_install_date\n FROM rides\n LEFT JOIN stations\n ON rides.start_station_id = stations.id\n)\n\nSELECT \n total_minutes \n , total_bike_hires \n , average_duration \n , month \n , start_peak_travel\n , same_station_flag\n , start_station_id\n , start_station_name\n , start_station_bikes_count \n , start_station_docks_count \n , start_station_install_date \n , end_station_id\n , end_station_name\n , stations.bikes_count as end_station_bikes_count\n , stations.docks_count as end_station_docks_count\n , stations.install_date as end_station_install_date\nFROM start_stat_join\nLEFT JOIN stations\nON start_stat_join.end_station_id = stations.id", "compiledSql": "WITH stations AS (\n\n SELECT *\n FROM ACME.ride_share.raw_bike_stations\n\n),\n\nrides AS (\n\n SELECT *\n FROM ACME.ride_share.cleaned_bike_rides\n\n),\n\nstart_stat_join AS (\n\n SELECT rides.*\n , stations.bikes_count as start_station_bikes_count\n , stations.docks_count as start_station_docks_count\n , stations.install_date as start_station_install_date\n FROM rides\n LEFT JOIN stations\n ON rides.start_station_id = stations.id\n)\n\nSELECT \n total_minutes \n , total_bike_hires \n , average_duration \n , month \n , start_peak_travel\n , same_station_flag\n , start_station_id\n , start_station_name\n , start_station_bikes_count \n , start_station_docks_count \n , start_station_install_date \n , end_station_id\n , end_station_name\n , stations.bikes_count as end_station_bikes_count\n , stations.docks_count as end_station_docks_count\n , stations.install_date as end_station_install_date\nFROM start_stat_join\nLEFT JOIN stations\nON start_stat_join.end_station_id = stations.id", "database": "ACME", @@ -671,6 +676,7 @@ "type": "DATE" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "SELECT \n SUM(total_minutes) AS total_minutes\n , ROUND(SUM(total_minutes) / 60 ,2) AS total_hours\n , SUM(total_bike_hires) AS total_bike_hires\n , ROUND(SUM(total_minutes) / SUM(total_bike_hires), 2) AS average_duration_in_minutes\n , month\n , start_peak_travel\n , same_station_flag\n , start_station_id\n , start_station_name\n , start_station_bikes_count\n , start_station_docks_count\n , start_station_install_date\nFROM ACME.ride_share.rides_by_month_2017\nGROUP BY 5,6,7,8,9,10,11,12\nORDER BY total_bike_hires DESC", "compiledSql": "SELECT \n SUM(total_minutes) AS total_minutes\n , ROUND(SUM(total_minutes) / 60 ,2) AS total_hours\n , SUM(total_bike_hires) AS total_bike_hires\n , ROUND(SUM(total_minutes) / SUM(total_bike_hires), 2) AS average_duration_in_minutes\n , month\n , start_peak_travel\n , same_station_flag\n , start_station_id\n , start_station_name\n , start_station_bikes_count\n , start_station_docks_count\n , start_station_install_date\nFROM ACME.ride_share.rides_by_month_2017\nGROUP BY 5,6,7,8,9,10,11,12\nORDER BY total_bike_hires DESC", "database": "ACME", diff --git a/tests/dbt/cloud/fake_graphql_server/get_job_run_models/metaphor_subscriptions.json b/tests/dbt/cloud/fake_graphql_server/get_job_run_models/metaphor_subscriptions.json index 6c15025b..4452152d 100644 --- a/tests/dbt/cloud/fake_graphql_server/get_job_run_models/metaphor_subscriptions.json +++ b/tests/dbt/cloud/fake_graphql_server/get_job_run_models/metaphor_subscriptions.json @@ -45,6 +45,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "select \n 1 as id,\n subscriptions_growth.customer_id as cus_id,\n 'no' as reason,\n subscriptions_growth.created_at as sub_date,\n '2014-01-01 16:00:00' as cancel_date\nfrom DEMO_DB.METAPHOR.subscriptions_growth as subscriptions_growth", "compiledSql": "select \n 1 as id,\n subscriptions_growth.customer_id as cus_id,\n 'no' as reason,\n subscriptions_growth.created_at as sub_date,\n '2014-01-01 16:00:00' as cancel_date\nfrom DEMO_DB.METAPHOR.subscriptions_growth as subscriptions_growth", "database": "DEMO_DB", @@ -121,6 +122,7 @@ "type": "TIMESTAMP_NTZ" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "select \n 1 as id,\n 'name' as name,\n 'poc' as poc,\n 100 as budget,\n churn_region_agg.sub_date as date\nfrom DEMO_DB.METAPHOR.churn_region_agg as churn_region_agg", "compiledSql": "select \n 1 as id,\n 'name' as name,\n 'poc' as poc,\n 100 as budget,\n churn_region_agg.sub_date as date\nfrom DEMO_DB.METAPHOR.churn_region_agg as churn_region_agg", "database": "DEMO_DB", @@ -178,6 +180,7 @@ "type": "TIMESTAMP_NTZ" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "select \n 1 as sub_id,\n 'url' as url,\n customer_profile.date as created_at\nfrom DEMO_DB.METAPHOR.CUSTOMER_PROFILE as customer_profile", "compiledSql": "select \n 1 as sub_id,\n 'url' as url,\n customer_profile.date as created_at\nfrom DEMO_DB.METAPHOR.CUSTOMER_PROFILE as customer_profile", "database": "DEMO_DB", @@ -232,6 +235,7 @@ "type": "TIMESTAMP_NTZ" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "select \n change_raw.sub_id as sub_id,\n 1 as customer_id, \n base.created_at as created_at\nfrom DEMO_DB.METAPHOR.SUBSCRIPTIONS_CHANGE_RAW as change_raw\ninner join DEMO_DB.METAPHOR.SUBSCRIPTIONS_BASE as base on base.sub_id = change_raw.sub_id\ninner join DEMO_DB.METAPHOR.subscriptions_v2 as v2 on v2.sub_id = change_raw.sub_id", "compiledSql": "select \n change_raw.sub_id as sub_id,\n 1 as customer_id, \n base.created_at as created_at\nfrom DEMO_DB.METAPHOR.SUBSCRIPTIONS_CHANGE_RAW as change_raw\ninner join DEMO_DB.METAPHOR.SUBSCRIPTIONS_BASE as base on base.sub_id = change_raw.sub_id\ninner join DEMO_DB.METAPHOR.subscriptions_v2 as v2 on v2.sub_id = change_raw.sub_id", "database": "DEMO_DB", @@ -310,6 +314,7 @@ "type": "TEXT" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "select \n 1 as sales_id,\n subscriptions_growth.sub_id as sub_id,\n 1 as sale_rep_id,\n 1 as deal_size,\n '2014-01-01 16:00:00' as created_at\nfrom DEMO_DB.METAPHOR.subscriptions_growth as subscriptions_growth", "compiledSql": "select \n 1 as sales_id,\n subscriptions_growth.sub_id as sub_id,\n 1 as sale_rep_id,\n 1 as deal_size,\n '2014-01-01 16:00:00' as created_at\nfrom DEMO_DB.METAPHOR.subscriptions_growth as subscriptions_growth", "database": "DEMO_DB", @@ -402,6 +407,7 @@ "type": "TIMESTAMP_NTZ" } ], + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "select \n 1 as sub_id,\n 'short name' as short_name,\n 'long name' as long_name,\n 'region' as region,\n 1 as price,\n 'type' as renew_type,\n customer_profile.date as created_at\nfrom DEMO_DB.METAPHOR.CUSTOMER_PROFILE as customer_profile", "compiledSql": "select \n 1 as sub_id,\n 'short name' as short_name,\n 'long name' as long_name,\n 'region' as region,\n 1 as price,\n 'type' as renew_type,\n customer_profile.date as created_at\nfrom DEMO_DB.METAPHOR.CUSTOMER_PROFILE as customer_profile", "database": "DEMO_DB", diff --git a/tests/dbt/cloud/fake_graphql_server/get_job_run_snapshots/london_bike_analysis.json b/tests/dbt/cloud/fake_graphql_server/get_job_run_snapshots/london_bike_analysis.json index eb7b7776..632c7714 100644 --- a/tests/dbt/cloud/fake_graphql_server/get_job_run_snapshots/london_bike_analysis.json +++ b/tests/dbt/cloud/fake_graphql_server/get_job_run_snapshots/london_bike_analysis.json @@ -159,6 +159,7 @@ } ], "comment": "", + "compileCompletedAt": "2024-01-01T00:00:00.000Z", "compiledCode": "\n\n\nselect * from ACME.berlin_bicycles.cycle_hire", "compiledSql": "\n\n\nselect * from ACME.berlin_bicycles.cycle_hire", "database": "ACME", diff --git a/tests/dbt/cloud/test_dbt_test_parser.py b/tests/dbt/cloud/test_dbt_test_parser.py index 2fc9f530..98d052b2 100644 --- a/tests/dbt/cloud/test_dbt_test_parser.py +++ b/tests/dbt/cloud/test_dbt_test_parser.py @@ -82,6 +82,7 @@ def test_dbt_test_parser(): type="TEXT", ), ], + compileCompletedAt=datetime.fromisoformat("2024-01-01T00:00:00"), compiledCode="compiledCode", compiledSql="compiledSql", database=None,