Skip to content

Commit

Permalink
[sc-29858] Only update dbt_model.compiled_sql when `node.compile_co…
Browse files Browse the repository at this point in the history
…mpleted_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
  • Loading branch information
usefulalgorithm authored Nov 14, 2024
1 parent 2f39bdd commit db596ce
Show file tree
Hide file tree
Showing 14 changed files with 291 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/metaphor/dbt/cloud/discovery_api/generated/** linguist-generated
/metaphor/dbt/cloud/discovery_api/schema.graphql linguist-generated
2 changes: 2 additions & 0 deletions metaphor/dbt/cloud/discovery_api/generated/client.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions metaphor/dbt/cloud/discovery_api/generated/enums.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions metaphor/dbt/cloud/discovery_api/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ query GetJobRunModels($jobId: BigInt!, $runId: BigInt!) {
tags
type
}
compileCompletedAt
compiledCode
compiledSql
database
Expand Down Expand Up @@ -47,6 +48,7 @@ query GetJobRunSnapshots($jobId: BigInt!, $runId: BigInt!) {
type
}
comment
compileCompletedAt
compiledCode
compiledSql
database
Expand Down
257 changes: 254 additions & 3 deletions metaphor/dbt/cloud/discovery_api/schema.graphql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion metaphor/dbt/cloud/parser/dbt_node_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>"]
Expand Down
Loading

0 comments on commit db596ce

Please sign in to comment.