Skip to content

Commit

Permalink
Merge pull request #313 from godatadriven/add-dbt-19-to-tests
Browse files Browse the repository at this point in the history
Adding dbt 1.9 to tests
  • Loading branch information
pgoslatara authored Dec 9, 2024
2 parents d53e47a + 22520ae commit 0b4c4ec
Show file tree
Hide file tree
Showing 9 changed files with 327 additions and 289 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,11 @@ tests/fixtures/dbt_18/target/graph.gpickle
tests/fixtures/dbt_18/target/partial_parse.msgpack
tests/fixtures/dbt_18/target/perf_info.json
tests/fixtures/dbt_18/target/semantic_manifest.json
tests/fixtures/dbt_19/target/compiled/
tests/fixtures/dbt_19/target/index.html
tests/fixtures/dbt_19/target/graph_summary.json
tests/fixtures/dbt_19/target/graph.gpickle
tests/fixtures/dbt_19/target/partial_parse.msgpack
tests/fixtures/dbt_19/target/perf_info.json
tests/fixtures/dbt_19/target/semantic_manifest.json
tmp/
2 changes: 1 addition & 1 deletion dbt_project/target/catalog.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dbt_project/target/manifest.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dbt_project/target/run_results.json

Large diffs are not rendered by default.

591 changes: 310 additions & 281 deletions poetry.lock

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions scripts/generate_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
def build_pex_file(dbt_version, pex_file_name):
"""Build a pex file of `dbt-bouncer` if it does not already exist."""
if not Path(pex_file_name).exists():
logging.info(f"Building pex file for dbt version {dbt_version}")
logging.info(f"Building pex file for dbt version {dbt_version}") # noqa: LOG015
sh.poetry(
[
"run",
Expand All @@ -23,14 +23,13 @@ def build_pex_file(dbt_version, pex_file_name):
"--output-file",
pex_file_name,
"--pip-version",
"23.2",
"24.1",
"--python-shebang",
"/usr/bin/env python",
"--script",
"dbt",
f"dbt-core=={dbt_version}",
f"dbt-duckdb=={dbt_version}",
"protobuf<5",
"pytz",
],
_fg=True,
Expand All @@ -43,7 +42,7 @@ def generate_artifacts(
pex_file_name,
):
"""Generate dbt artifacts for all specified versions of dbt. These artifacts are used in testing."""
logging.info(f"Generating dbt artifacts for dbt version {dbt_version}")
logging.info(f"Generating dbt artifacts for dbt version {dbt_version}") # noqa: LOG015
Path(artifact_path).mkdir(exist_ok=True, parents=True)
sh.python(
[
Expand Down Expand Up @@ -87,7 +86,7 @@ def generate_artifacts(

def main():
"""For the specified dbt versions, build a pex file and generate dbt artifacts in the `./tests` directory."""
dbt_versions = ["1.6", "1.7", "1.8"]
dbt_versions = ["1.6", "1.7", "1.8", "1.9"]

for dbt_version in dbt_versions:
pex_file_name = f"./dist/dbt-{dbt_version.replace('.', '')}.pex"
Expand Down
1 change: 1 addition & 0 deletions tests/fixtures/dbt_19/target/catalog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"metadata": {"dbt_schema_version": "https://schemas.getdbt.com/dbt/catalog/v1.json", "dbt_version": "1.9.0", "generated_at": "2024-12-09T20:27:53.562695Z", "invocation_id": "4ee11da6-5a28-48a8-b67c-64bf03f18ff9", "env": {}}, "nodes": {"snapshot.dbt_bouncer_test_project.orders_snapshot": {"metadata": {"type": "BASE TABLE", "schema": "dbt_pslattery", "name": "orders_snapshot", "database": "dbt", "comment": null, "owner": null}, "columns": {"id": {"type": "INTEGER", "index": 1, "name": "id", "comment": null}, "user_id": {"type": "INTEGER", "index": 2, "name": "user_id", "comment": null}, "order_date": {"type": "DATE", "index": 3, "name": "order_date", "comment": null}, "status": {"type": "VARCHAR", "index": 4, "name": "status", "comment": null}, "dbt_scd_id": {"type": "VARCHAR", "index": 5, "name": "dbt_scd_id", "comment": null}, "dbt_updated_at": {"type": "DATE", "index": 6, "name": "dbt_updated_at", "comment": null}, "dbt_valid_from": {"type": "DATE", "index": 7, "name": "dbt_valid_from", "comment": null}, "dbt_valid_to": {"type": "DATE", "index": 8, "name": "dbt_valid_to", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "snapshot.dbt_bouncer_test_project.orders_snapshot"}, "model.dbt_bouncer_test_project.customers": {"metadata": {"type": "BASE TABLE", "schema": "main", "name": "customers", "database": "dbt", "comment": null, "owner": null}, "columns": {"customer_id": {"type": "BIGINT", "index": 1, "name": "customer_id", "comment": null}, "first_name": {"type": "VARCHAR", "index": 2, "name": "first_name", "comment": null}, "last_name": {"type": "VARCHAR", "index": 3, "name": "last_name", "comment": null}, "first_order_date": {"type": "DATE", "index": 4, "name": "first_order_date", "comment": null}, "most_recent_order_date": {"type": "DATE", "index": 5, "name": "most_recent_order_date", "comment": null}, "number_of_orders": {"type": "BIGINT", "index": 6, "name": "number_of_orders", "comment": null}, "is_recurring_customer": {"type": "BOOLEAN", "index": 7, "name": "is_recurring_customer", "comment": null}, "customer_lifetime_value": {"type": "DOUBLE", "index": 8, "name": "customer_lifetime_value", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_bouncer_test_project.customers"}, "model.dbt_bouncer_test_project.metricflow_time_spine": {"metadata": {"type": "BASE TABLE", "schema": "main", "name": "metricflow_time_spine", "database": "dbt", "comment": null, "owner": null}, "columns": {"date_day": {"type": "DATE", "index": 1, "name": "date_day", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_bouncer_test_project.metricflow_time_spine"}, "model.dbt_bouncer_test_project.orders": {"metadata": {"type": "VIEW", "schema": "main", "name": "orders", "database": "dbt", "comment": null, "owner": null}, "columns": {"order_id": {"type": "INTEGER", "index": 1, "name": "order_id", "comment": null}, "customer_id": {"type": "INTEGER", "index": 2, "name": "customer_id", "comment": null}, "order_date": {"type": "DATE", "index": 3, "name": "order_date", "comment": null}, "status": {"type": "VARCHAR", "index": 4, "name": "status", "comment": null}, "credit_card_amount": {"type": "DOUBLE", "index": 5, "name": "credit_card_amount", "comment": null}, "coupon_amount": {"type": "DOUBLE", "index": 6, "name": "coupon_amount", "comment": null}, "bank_transfer_amount": {"type": "DOUBLE", "index": 7, "name": "bank_transfer_amount", "comment": null}, "gift_card_amount": {"type": "DOUBLE", "index": 8, "name": "gift_card_amount", "comment": null}, "amount": {"type": "DOUBLE", "index": 9, "name": "amount", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_bouncer_test_project.orders"}, "seed.dbt_bouncer_test_project.raw_customers": {"metadata": {"type": "BASE TABLE", "schema": "main", "name": "raw_customers", "database": "dbt", "comment": null, "owner": null}, "columns": {"id": {"type": "INTEGER", "index": 1, "name": "id", "comment": null}, "first_name": {"type": "VARCHAR", "index": 2, "name": "first_name", "comment": null}, "last_name": {"type": "VARCHAR", "index": 3, "name": "last_name", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.dbt_bouncer_test_project.raw_customers"}, "seed.dbt_bouncer_test_project.raw_orders": {"metadata": {"type": "BASE TABLE", "schema": "main", "name": "raw_orders", "database": "dbt", "comment": null, "owner": null}, "columns": {"id": {"type": "INTEGER", "index": 1, "name": "id", "comment": null}, "user_id": {"type": "INTEGER", "index": 2, "name": "user_id", "comment": null}, "order_date": {"type": "DATE", "index": 3, "name": "order_date", "comment": null}, "status": {"type": "VARCHAR", "index": 4, "name": "status", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.dbt_bouncer_test_project.raw_orders"}, "seed.dbt_bouncer_test_project.raw_payments": {"metadata": {"type": "BASE TABLE", "schema": "main", "name": "raw_payments", "database": "dbt", "comment": null, "owner": null}, "columns": {"id": {"type": "INTEGER", "index": 1, "name": "id", "comment": null}, "order_id": {"type": "INTEGER", "index": 2, "name": "order_id", "comment": null}, "payment_method": {"type": "VARCHAR", "index": 3, "name": "payment_method", "comment": null}, "amount": {"type": "INTEGER", "index": 4, "name": "amount", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "seed.dbt_bouncer_test_project.raw_payments"}, "model.dbt_bouncer_test_project.stg_customers": {"metadata": {"type": "VIEW", "schema": "main", "name": "stg_customers", "database": "dbt", "comment": null, "owner": null}, "columns": {"customer_id": {"type": "BIGINT", "index": 1, "name": "customer_id", "comment": null}, "first_name": {"type": "VARCHAR", "index": 2, "name": "first_name", "comment": null}, "last_name": {"type": "VARCHAR", "index": 3, "name": "last_name", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_bouncer_test_project.stg_customers"}, "model.dbt_bouncer_test_project.stg_orders": {"metadata": {"type": "VIEW", "schema": "main", "name": "stg_orders", "database": "dbt", "comment": null, "owner": null}, "columns": {"order_id": {"type": "INTEGER", "index": 1, "name": "order_id", "comment": null}, "customer_id": {"type": "INTEGER", "index": 2, "name": "customer_id", "comment": null}, "order_date": {"type": "DATE", "index": 3, "name": "order_date", "comment": null}, "status": {"type": "VARCHAR", "index": 4, "name": "status", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_bouncer_test_project.stg_orders"}, "model.dbt_bouncer_test_project.stg_payments": {"metadata": {"type": "VIEW", "schema": "main", "name": "stg_payments", "database": "dbt", "comment": null, "owner": null}, "columns": {"payment_id": {"type": "INTEGER", "index": 1, "name": "payment_id", "comment": null}, "order_id": {"type": "INTEGER", "index": 2, "name": "order_id", "comment": null}, "payment_method": {"type": "VARCHAR", "index": 3, "name": "payment_method", "comment": null}, "amount": {"type": "DOUBLE", "index": 4, "name": "amount", "comment": null}}, "stats": {"has_stats": {"id": "has_stats", "label": "Has Stats?", "value": false, "include": false, "description": "Indicates whether there are statistics for this table"}}, "unique_id": "model.dbt_bouncer_test_project.stg_payments"}}, "sources": {}, "errors": null}
1 change: 1 addition & 0 deletions tests/fixtures/dbt_19/target/manifest.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/fixtures/dbt_19/target/run_results.json

Large diffs are not rendered by default.

0 comments on commit 0b4c4ec

Please sign in to comment.