From c3503631223ce57549a4f90c4dd3838a6d90e96d Mon Sep 17 00:00:00 2001 From: Scott Ssuyi Huang Date: Fri, 23 Aug 2024 20:46:46 +0800 Subject: [PATCH] dbt cloud crawler is not extract test status (#962) * Extract test status from tests connection Remove * Bump version --- .../cloud/discovery_api/generated/__init__.py | 2 + .../cloud/discovery_api/generated/client.py | 2 + .../cloud/discovery_api/generated/enums.py | 6 + .../generated/get_job_run_tests.py | 4 +- .../dbt/cloud/discovery_api/queries.graphql | 2 + .../dbt/cloud/discovery_api/schema.graphql | 26 ++++ metaphor/dbt/cloud/parser/dbt_test_parser.py | 53 ++----- pyproject.toml | 2 +- tests/dbt/cloud/expected.json | 76 ++++----- .../get_job_run_tests/jaffle_shop.json | 144 +++++++++++------- tests/dbt/cloud/test_dbt_test_parser.py | 6 +- 11 files changed, 185 insertions(+), 138 deletions(-) diff --git a/metaphor/dbt/cloud/discovery_api/generated/__init__.py b/metaphor/dbt/cloud/discovery_api/generated/__init__.py index 3f5290ba..d32315f7 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/__init__.py +++ b/metaphor/dbt/cloud/discovery_api/generated/__init__.py @@ -8,6 +8,7 @@ AncestorNodeType, AppliedModelSortField, FreshnessStatus, + OwnerResourceType, PackageResourceType, ReleaseVersion, ResourceNodeType, @@ -141,6 +142,7 @@ "MacroDefinitionFilter", "ModelAppliedFilter", "ModelDefinitionFilter", + "OwnerResourceType", "PackageResourceType", "ReleaseVersion", "ResourceNodeType", diff --git a/metaphor/dbt/cloud/discovery_api/generated/client.py b/metaphor/dbt/cloud/discovery_api/generated/client.py index 0959d2b5..f393af0a 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/client.py +++ b/metaphor/dbt/cloud/discovery_api/generated/client.py @@ -235,6 +235,8 @@ def get_job_run_tests( dependsOn name uniqueId + status + executeCompletedAt } } } diff --git a/metaphor/dbt/cloud/discovery_api/generated/enums.py b/metaphor/dbt/cloud/discovery_api/generated/enums.py index eb4102f3..836470d7 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/enums.py +++ b/metaphor/dbt/cloud/discovery_api/generated/enums.py @@ -29,9 +29,15 @@ class AppliedModelSortField(str, Enum): class FreshnessStatus(str, Enum): Error = "Error" Pass = "Pass" + Unknown = "Unknown" Warn = "Warn" +class OwnerResourceType(str, Enum): + exposure = "exposure" + group = "group" + + class PackageResourceType(str, Enum): macro = "macro" model = "model" diff --git a/metaphor/dbt/cloud/discovery_api/generated/get_job_run_tests.py b/metaphor/dbt/cloud/discovery_api/generated/get_job_run_tests.py index 146407d6..55ad4dcf 100644 --- a/metaphor/dbt/cloud/discovery_api/generated/get_job_run_tests.py +++ b/metaphor/dbt/cloud/discovery_api/generated/get_job_run_tests.py @@ -1,7 +1,7 @@ # Generated by ariadne-codegen # Source: queries.graphql -from typing import List, Optional +from typing import Any, List, Optional from pydantic import Field @@ -23,6 +23,8 @@ class GetJobRunTestsJobTests(BaseModel): depends_on: List[str] = Field(alias="dependsOn") name: Optional[str] unique_id: str = Field(alias="uniqueId") + status: Optional[str] + execute_completed_at: Optional[Any] = Field(alias="executeCompletedAt") GetJobRunTests.model_rebuild() diff --git a/metaphor/dbt/cloud/discovery_api/queries.graphql b/metaphor/dbt/cloud/discovery_api/queries.graphql index 5db5ab2d..ca2574ca 100644 --- a/metaphor/dbt/cloud/discovery_api/queries.graphql +++ b/metaphor/dbt/cloud/discovery_api/queries.graphql @@ -130,6 +130,8 @@ query GetJobRunTests($jobId: BigInt!, $runId: BigInt!) { dependsOn name uniqueId + status + executeCompletedAt } } } diff --git a/metaphor/dbt/cloud/discovery_api/schema.graphql b/metaphor/dbt/cloud/discovery_api/schema.graphql index 4382a2aa..79fe8d25 100644 --- a/metaphor/dbt/cloud/discovery_api/schema.graphql +++ b/metaphor/dbt/cloud/discovery_api/schema.graphql @@ -87,6 +87,9 @@ type AppliedState { """ lastUpdatedAt: DateTime + """The git sha of the project when the applied state was last updated.""" + latestGitSha: String + """Project Lineage.""" lineage( """Lineage Filter""" @@ -122,6 +125,10 @@ type AppliedState { """Sort by""" sort: AppliedModelSort ): ModelAppliedStateNodeConnection! + owners( + """Filter by resource type""" + resource: OwnerResourceType! + ): [ExposureOwner!]! """List of packages used in the environment""" packages( @@ -790,6 +797,9 @@ type ExposureDefinitionNode implements EnvironmentDefinitionNode { """The fully qualified name of this exposure""" fqn: [String!]! + """Freshness status of the source""" + freshnessStatus: FreshnessStatus + """Exposure Label""" label: String @@ -1000,6 +1010,15 @@ type ExposureNode implements CloudArtifactInterface & NodeInterface { url: String } +"""The owners of exposure""" +type ExposureOwner { + """The email of the owner""" + email: String! + + """The name of the owner""" + name: String! +} + """Public model from another project""" type ExternalModelNode implements EnvironmentAppliedNestedNode & EnvironmentDefinitionNestedNode { """The account ID of this node""" @@ -1054,6 +1073,7 @@ type ExternalModelNode implements EnvironmentAppliedNestedNode & EnvironmentDefi enum FreshnessStatus { Error Pass + Unknown Warn } @@ -2850,6 +2870,12 @@ interface NodeInterface { uniqueId: String! } +"""The type of owner""" +enum OwnerResourceType { + exposure + group +} + """The type of package resource""" enum PackageResourceType { macro diff --git a/metaphor/dbt/cloud/parser/dbt_test_parser.py b/metaphor/dbt/cloud/parser/dbt_test_parser.py index 714d069d..2ee47ee1 100644 --- a/metaphor/dbt/cloud/parser/dbt_test_parser.py +++ b/metaphor/dbt/cloud/parser/dbt_test_parser.py @@ -1,13 +1,10 @@ from datetime import datetime -from typing import Dict, List, Optional +from typing import Any, Dict, Optional from metaphor.common.logger import get_logger from metaphor.dbt.cloud.discovery_api.generated.get_job_run_models import ( GetJobRunModelsJobModels as Model, ) -from metaphor.dbt.cloud.discovery_api.generated.get_job_run_models import ( - GetJobRunModelsJobModelsRunResults as RunResult, -) from metaphor.dbt.cloud.discovery_api.generated.get_job_run_tests import ( GetJobRunTestsJobTests as Test, ) @@ -70,8 +67,6 @@ def parse( if model_unique_id not in models: return - model = models[model_unique_id] - dbt_test = DbtTest( name=test.name, unique_id=test.unique_id, @@ -84,19 +79,16 @@ def parse( init_dbt_tests(self._virtual_views, model_unique_id).append(dbt_test) - if model.run_results: - self._parse_test_run_result( - test, models[model_unique_id], model.run_results - ) + self._parse_test_run_result(test, models[model_unique_id]) @staticmethod - def _get_run_result_executed_completed_at( - run_result: RunResult, + def _parse_date_time_from_result( + field: Optional[Any], ) -> Optional[datetime]: - if isinstance(run_result.execute_completed_at, datetime): - return run_result.execute_completed_at - if isinstance(run_result.execute_completed_at, str): - completed_at = run_result.execute_completed_at + if isinstance(field, datetime): + return field + if isinstance(field, str): + completed_at = field if completed_at.endswith("Z"): # Convert Zulu to +00:00 completed_at = f"{completed_at[:-1]}+00:00" @@ -110,36 +102,13 @@ def _parse_test_run_result( self, test: Test, model: Model, - run_results: List[RunResult], ) -> None: model_name = model.alias or model.name if model.database is None or model.schema_ is None or model_name is None: logger.warning(f"Skipping model without name, {model.unique_id}") return - if not test.name: - return - - if not run_results: - logger.warning(f"Skipping test without run_results, {model.unique_id}") - return - - def run_result_key(run_result: RunResult): - completed_at = self._get_run_result_executed_completed_at(run_result) - if not completed_at: - return 0 - return completed_at.timestamp() - - run_result = next( - ( - n - for n in sorted(run_results, key=run_result_key, reverse=True) - if n.status - ), - None, - ) - if run_result is None or run_result.status is None: - logger.warning(f"No valid run_result found: {run_results}") + if not test.name or test.status is None or test.execute_completed_at is None: return dataset = init_dataset( @@ -152,6 +121,6 @@ def run_result_key(run_result: RunResult): model.unique_id, ) - status = dbt_run_result_output_data_monitor_status_map[run_result.status] - last_run = self._get_run_result_executed_completed_at(run_result) + status = dbt_run_result_output_data_monitor_status_map[test.status] + last_run = self._parse_date_time_from_result(test.execute_completed_at) add_data_quality_monitor(dataset, test.name, test.column_name, status, last_run) diff --git a/pyproject.toml b/pyproject.toml index aa2ff4a1..e702bf1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "metaphor-connectors" -version = "0.14.85" +version = "0.14.86" 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/expected.json b/tests/dbt/cloud/expected.json index 5e7255e9..c6c0c022 100644 --- a/tests/dbt/cloud/expected.json +++ b/tests/dbt/cloud/expected.json @@ -3,8 +3,8 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:41.238000+00:00", - "status": "PASSED", + "lastRun": "2024-08-23T04:01:32.701000+00:00", + "status": "WARNING", "targets": [ { "column": "customer_type", @@ -14,8 +14,8 @@ "title": "accepted_values_customers_customer_type__new__returning" }, { - "lastRun": "2024-07-24T04:01:41.238000+00:00", - "status": "PASSED", + "lastRun": "2024-08-23T04:01:33.200000+00:00", + "status": "ERROR", "targets": [ { "column": "customer_id", @@ -25,7 +25,7 @@ "title": "not_null_customers_customer_id" }, { - "lastRun": "2024-07-24T04:01:41.238000+00:00", + "lastRun": "2024-08-23T04:01:33.370000+00:00", "status": "PASSED", "targets": [ { @@ -48,7 +48,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:39.404000+00:00", + "lastRun": "2024-08-23T04:01:33.173000+00:00", "status": "PASSED", "targets": [ { @@ -59,7 +59,7 @@ "title": "not_null_orders_order_id" }, { - "lastRun": "2024-07-24T04:01:39.404000+00:00", + "lastRun": "2024-08-23T04:01:33.468000+00:00", "status": "PASSED", "targets": [ { @@ -70,7 +70,7 @@ "title": "relationships_orders_customer_id__customer_id__ref_stg_customers_" }, { - "lastRun": "2024-07-24T04:01:39.404000+00:00", + "lastRun": "2024-08-23T04:01:33.470000+00:00", "status": "PASSED", "targets": [ { @@ -93,7 +93,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:35.949000+00:00", + "lastRun": "2024-08-23T04:01:33.113000+00:00", "status": "PASSED", "targets": [ { @@ -104,7 +104,7 @@ "title": "not_null_stg_customers_customer_id" }, { - "lastRun": "2024-07-24T04:01:35.949000+00:00", + "lastRun": "2024-08-23T04:01:33.520000+00:00", "status": "PASSED", "targets": [ { @@ -127,7 +127,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:35.994000+00:00", + "lastRun": "2024-08-23T04:01:32.864000+00:00", "status": "PASSED", "targets": [ { @@ -138,7 +138,7 @@ "title": "not_null_stg_locations_location_id" }, { - "lastRun": "2024-07-24T04:01:35.994000+00:00", + "lastRun": "2024-08-23T04:01:33.541000+00:00", "status": "PASSED", "targets": [ { @@ -161,7 +161,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:35.953000+00:00", + "lastRun": "2024-08-23T04:01:33.006000+00:00", "status": "PASSED", "targets": [ { @@ -172,7 +172,7 @@ "title": "not_null_stg_order_items_order_item_id" }, { - "lastRun": "2024-07-24T04:01:35.953000+00:00", + "lastRun": "2024-08-23T04:01:33.659000+00:00", "status": "PASSED", "targets": [ { @@ -195,7 +195,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:37.610000+00:00", + "lastRun": "2024-08-23T04:01:33.194000+00:00", "status": "PASSED", "targets": [ { @@ -206,7 +206,7 @@ "title": "not_null_stg_orders_order_id" }, { - "lastRun": "2024-07-24T04:01:37.610000+00:00", + "lastRun": "2024-08-23T04:01:33.663000+00:00", "status": "PASSED", "targets": [ { @@ -229,7 +229,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:36.921000+00:00", + "lastRun": "2024-08-23T04:01:33.253000+00:00", "status": "PASSED", "targets": [ { @@ -240,7 +240,7 @@ "title": "not_null_stg_products_product_id" }, { - "lastRun": "2024-07-24T04:01:36.921000+00:00", + "lastRun": "2024-08-23T04:01:33.681000+00:00", "status": "PASSED", "targets": [ { @@ -263,7 +263,7 @@ "dataQuality": { "monitors": [ { - "lastRun": "2024-07-24T04:01:37.035000+00:00", + "lastRun": "2024-08-23T04:01:33.357000+00:00", "status": "PASSED", "targets": [ { @@ -274,7 +274,7 @@ "title": "not_null_stg_supplies_supply_uuid" }, { - "lastRun": "2024-07-24T04:01:37.035000+00:00", + "lastRun": "2024-08-23T04:01:33.720000+00:00", "status": "PASSED", "targets": [ { @@ -377,7 +377,7 @@ "macro.dbt.test_accepted_values" ], "name": "accepted_values_customers_customer_type__new__returning", - "sql": "\\n \\n \\n\\nwith all_values as (\\n\\n select\\n customer_type as value_field,\\n count(*) as n_records\\n\\n from acme.jaffle_shop.customers\\n group by customer_type\\n\\n)\\n\\nselect *\\nfrom all_values\\nwhere value_field not in (\\n 'new','returning'\\n)\\n\\n\\n", + "sql": "\n \n \n\nwith all_values as (\n\n select\n customer_type as value_field,\n count(*) as n_records\n\n from acme.jaffle_shop.customers\n group by customer_type\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'new','returning'\n)\n\n\n", "uniqueId": "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8" }, { @@ -389,7 +389,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_customers_customer_id", - "sql": "\\n \\n \\n\\n\\n\\nselect customer_id\\nfrom acme.jaffle_shop.customers\\nwhere customer_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect customer_id\nfrom acme.jaffle_shop.customers\nwhere customer_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d" }, { @@ -401,7 +401,7 @@ "macro.dbt.test_unique" ], "name": "unique_customers_customer_id", - "sql": "\\n \\n \\n\\nselect\\n customer_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.customers\\nwhere customer_id is not null\\ngroup by customer_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.customers\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1" } ], @@ -639,7 +639,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_orders_order_id", - "sql": "\\n \\n \\n\\n\\n\\nselect order_id\\nfrom acme.jaffle_shop.orders\\nwhere order_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect order_id\nfrom acme.jaffle_shop.orders\nwhere order_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_orders_order_id.cf6c17daed" }, { @@ -651,7 +651,7 @@ "macro.dbt.test_relationships" ], "name": "relationships_orders_customer_id__customer_id__ref_stg_customers_", - "sql": "\\n \\n \\n\\nwith child as (\\n select customer_id as from_field\\n from acme.jaffle_shop.orders\\n where customer_id is not null\\n),\\n\\nparent as (\\n select customer_id as to_field\\n from acme.jaffle_shop.stg_customers\\n)\\n\\nselect\\n from_field\\n\\nfrom child\\nleft join parent\\n on child.from_field = parent.to_field\\n\\nwhere parent.to_field is null\\n\\n\\n", + "sql": "\n \n \n\nwith child as (\n select customer_id as from_field\n from acme.jaffle_shop.orders\n where customer_id is not null\n),\n\nparent as (\n select customer_id as to_field\n from acme.jaffle_shop.stg_customers\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", "uniqueId": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16" }, { @@ -663,7 +663,7 @@ "macro.dbt.test_unique" ], "name": "unique_orders_order_id", - "sql": "\\n \\n \\n\\nselect\\n order_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.orders\\nwhere order_id is not null\\ngroup by order_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.orders\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_orders_order_id.fed79b3a6e" } ], @@ -724,7 +724,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_stg_customers_customer_id", - "sql": "\\n \\n \\n\\n\\n\\nselect customer_id\\nfrom acme.jaffle_shop.stg_customers\\nwhere customer_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect customer_id\nfrom acme.jaffle_shop.stg_customers\nwhere customer_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa" }, { @@ -736,7 +736,7 @@ "macro.dbt.test_unique" ], "name": "unique_stg_customers_customer_id", - "sql": "\\n \\n \\n\\nselect\\n customer_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_customers\\nwhere customer_id is not null\\ngroup by customer_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_customers\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada" } ], @@ -801,7 +801,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_stg_locations_location_id", - "sql": "\\n \\n \\n\\n\\n\\nselect location_id\\nfrom acme.jaffle_shop.stg_locations\\nwhere location_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect location_id\nfrom acme.jaffle_shop.stg_locations\nwhere location_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2" }, { @@ -813,7 +813,7 @@ "macro.dbt.test_unique" ], "name": "unique_stg_locations_location_id", - "sql": "\\n \\n \\n\\nselect\\n location_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_locations\\nwhere location_id is not null\\ngroup by location_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_locations\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc" } ], @@ -872,7 +872,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_stg_order_items_order_item_id", - "sql": "\\n \\n \\n\\n\\n\\nselect order_item_id\\nfrom acme.jaffle_shop.stg_order_items\\nwhere order_item_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect order_item_id\nfrom acme.jaffle_shop.stg_order_items\nwhere order_item_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35" }, { @@ -884,7 +884,7 @@ "macro.dbt.test_unique" ], "name": "unique_stg_order_items_order_item_id", - "sql": "\\n \\n \\n\\nselect\\n order_item_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_order_items\\nwhere order_item_id is not null\\ngroup by order_item_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_order_items\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108" } ], @@ -961,7 +961,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_stg_orders_order_id", - "sql": "\\n \\n \\n\\n\\n\\nselect order_id\\nfrom acme.jaffle_shop.stg_orders\\nwhere order_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect order_id\nfrom acme.jaffle_shop.stg_orders\nwhere order_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64" }, { @@ -973,7 +973,7 @@ "macro.dbt.test_unique" ], "name": "unique_stg_orders_order_id", - "sql": "\\n \\n \\n\\nselect\\n order_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_orders\\nwhere order_id is not null\\ngroup by order_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_orders\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a" } ], @@ -1056,7 +1056,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_stg_products_product_id", - "sql": "\\n \\n \\n\\n\\n\\nselect product_id\\nfrom acme.jaffle_shop.stg_products\\nwhere product_id is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect product_id\nfrom acme.jaffle_shop.stg_products\nwhere product_id is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3" }, { @@ -1068,7 +1068,7 @@ "macro.dbt.test_unique" ], "name": "unique_stg_products_product_id", - "sql": "\\n \\n \\n\\nselect\\n product_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_products\\nwhere product_id is not null\\ngroup by product_id\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n product_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_products\nwhere product_id is not null\ngroup by product_id\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_stg_products_product_id.7d950a1467" } ], @@ -1145,7 +1145,7 @@ "macro.dbt.test_not_null" ], "name": "not_null_stg_supplies_supply_uuid", - "sql": "\\n \\n \\n\\n\\n\\nselect supply_uuid\\nfrom acme.jaffle_shop.stg_supplies\\nwhere supply_uuid is null\\n\\n\\n", + "sql": "\n \n \n\n\n\nselect supply_uuid\nfrom acme.jaffle_shop.stg_supplies\nwhere supply_uuid is null\n\n\n", "uniqueId": "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d" }, { @@ -1157,7 +1157,7 @@ "macro.dbt.test_unique" ], "name": "unique_stg_supplies_supply_uuid", - "sql": "\\n \\n \\n\\nselect\\n supply_uuid as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_supplies\\nwhere supply_uuid is not null\\ngroup by supply_uuid\\nhaving count(*) > 1\\n\\n\\n", + "sql": "\n \n \n\nselect\n supply_uuid as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_supplies\nwhere supply_uuid is not null\ngroup by supply_uuid\nhaving count(*) > 1\n\n\n", "uniqueId": "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed" } ], diff --git a/tests/dbt/cloud/fake_graphql_server/get_job_run_tests/jaffle_shop.json b/tests/dbt/cloud/fake_graphql_server/get_job_run_tests/jaffle_shop.json index 08b0711f..9a8cbbf6 100644 --- a/tests/dbt/cloud/fake_graphql_server/get_job_run_tests/jaffle_shop.json +++ b/tests/dbt/cloud/fake_graphql_server/get_job_run_tests/jaffle_shop.json @@ -3,116 +3,134 @@ "tests": [ { "columnName": "customer_type", - "compiledSql": "\\n \\n \\n\\nwith all_values as (\\n\\n select\\n customer_type as value_field,\\n count(*) as n_records\\n\\n from acme.jaffle_shop.customers\\n group by customer_type\\n\\n)\\n\\nselect *\\nfrom all_values\\nwhere value_field not in (\\n 'new','returning'\\n)\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nwith all_values as (\\n\\n select\\n customer_type as value_field,\\n count(*) as n_records\\n\\n from acme.jaffle_shop.customers\\n group by customer_type\\n\\n)\\n\\nselect *\\nfrom all_values\\nwhere value_field not in (\\n 'new','returning'\\n)\\n\\n\\n", + "compiledSql": "\n \n \n\nwith all_values as (\n\n select\n customer_type as value_field,\n count(*) as n_records\n\n from acme.jaffle_shop.customers\n group by customer_type\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'new','returning'\n)\n\n\n", + "compiledCode": "\n \n \n\nwith all_values as (\n\n select\n customer_type as value_field,\n count(*) as n_records\n\n from acme.jaffle_shop.customers\n group by customer_type\n\n)\n\nselect *\nfrom all_values\nwhere value_field not in (\n 'new','returning'\n)\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_accepted_values", "model.jaffle_shop.customers" ], "name": "accepted_values_customers_customer_type__new__returning", - "uniqueId": "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8" + "uniqueId": "test.jaffle_shop.accepted_values_customers_customer_type__new__returning.d12f0947c8", + "status": "warn", + "executeCompletedAt": "2024-08-23T04:01:32.701Z" }, { "columnName": "customer_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect customer_id\\nfrom acme.jaffle_shop.customers\\nwhere customer_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect customer_id\\nfrom acme.jaffle_shop.customers\\nwhere customer_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect customer_id\nfrom acme.jaffle_shop.customers\nwhere customer_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect customer_id\nfrom acme.jaffle_shop.customers\nwhere customer_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.customers" ], "name": "not_null_customers_customer_id", - "uniqueId": "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d" + "uniqueId": "test.jaffle_shop.not_null_customers_customer_id.5c9bf9911d", + "status": "fail", + "executeCompletedAt": "2024-08-23T04:01:33.200Z" }, { "columnName": "order_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect order_id\\nfrom acme.jaffle_shop.orders\\nwhere order_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect order_id\\nfrom acme.jaffle_shop.orders\\nwhere order_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect order_id\nfrom acme.jaffle_shop.orders\nwhere order_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect order_id\nfrom acme.jaffle_shop.orders\nwhere order_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.orders" ], "name": "not_null_orders_order_id", - "uniqueId": "test.jaffle_shop.not_null_orders_order_id.cf6c17daed" + "uniqueId": "test.jaffle_shop.not_null_orders_order_id.cf6c17daed", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.173Z" }, { "columnName": "customer_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect customer_id\\nfrom acme.jaffle_shop.stg_customers\\nwhere customer_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect customer_id\\nfrom acme.jaffle_shop.stg_customers\\nwhere customer_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect customer_id\nfrom acme.jaffle_shop.stg_customers\nwhere customer_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect customer_id\nfrom acme.jaffle_shop.stg_customers\nwhere customer_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.stg_customers" ], "name": "not_null_stg_customers_customer_id", - "uniqueId": "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa" + "uniqueId": "test.jaffle_shop.not_null_stg_customers_customer_id.e2cfb1f9aa", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.113Z" }, { "columnName": "location_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect location_id\\nfrom acme.jaffle_shop.stg_locations\\nwhere location_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect location_id\\nfrom acme.jaffle_shop.stg_locations\\nwhere location_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect location_id\nfrom acme.jaffle_shop.stg_locations\nwhere location_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect location_id\nfrom acme.jaffle_shop.stg_locations\nwhere location_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.stg_locations" ], "name": "not_null_stg_locations_location_id", - "uniqueId": "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2" + "uniqueId": "test.jaffle_shop.not_null_stg_locations_location_id.3d237927d2", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:32.864Z" }, { "columnName": "order_item_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect order_item_id\\nfrom acme.jaffle_shop.stg_order_items\\nwhere order_item_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect order_item_id\\nfrom acme.jaffle_shop.stg_order_items\\nwhere order_item_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect order_item_id\nfrom acme.jaffle_shop.stg_order_items\nwhere order_item_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect order_item_id\nfrom acme.jaffle_shop.stg_order_items\nwhere order_item_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.stg_order_items" ], "name": "not_null_stg_order_items_order_item_id", - "uniqueId": "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35" + "uniqueId": "test.jaffle_shop.not_null_stg_order_items_order_item_id.26a7e2bc35", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.006Z" }, { "columnName": "order_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect order_id\\nfrom acme.jaffle_shop.stg_orders\\nwhere order_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect order_id\\nfrom acme.jaffle_shop.stg_orders\\nwhere order_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect order_id\nfrom acme.jaffle_shop.stg_orders\nwhere order_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect order_id\nfrom acme.jaffle_shop.stg_orders\nwhere order_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.stg_orders" ], "name": "not_null_stg_orders_order_id", - "uniqueId": "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64" + "uniqueId": "test.jaffle_shop.not_null_stg_orders_order_id.81cfe2fe64", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.194Z" }, { "columnName": "product_id", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect product_id\\nfrom acme.jaffle_shop.stg_products\\nwhere product_id is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect product_id\\nfrom acme.jaffle_shop.stg_products\\nwhere product_id is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect product_id\nfrom acme.jaffle_shop.stg_products\nwhere product_id is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect product_id\nfrom acme.jaffle_shop.stg_products\nwhere product_id is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.stg_products" ], "name": "not_null_stg_products_product_id", - "uniqueId": "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3" + "uniqueId": "test.jaffle_shop.not_null_stg_products_product_id.6373b0acf3", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.253Z" }, { "columnName": "supply_uuid", - "compiledSql": "\\n \\n \\n\\n\\n\\nselect supply_uuid\\nfrom acme.jaffle_shop.stg_supplies\\nwhere supply_uuid is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\n\\n\\nselect supply_uuid\\nfrom acme.jaffle_shop.stg_supplies\\nwhere supply_uuid is null\\n\\n\\n", + "compiledSql": "\n \n \n\n\n\nselect supply_uuid\nfrom acme.jaffle_shop.stg_supplies\nwhere supply_uuid is null\n\n\n", + "compiledCode": "\n \n \n\n\n\nselect supply_uuid\nfrom acme.jaffle_shop.stg_supplies\nwhere supply_uuid is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_not_null", "model.jaffle_shop.stg_supplies" ], "name": "not_null_stg_supplies_supply_uuid", - "uniqueId": "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d" + "uniqueId": "test.jaffle_shop.not_null_stg_supplies_supply_uuid.515c6eda6d", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.357Z" }, { "columnName": "customer_id", - "compiledSql": "\\n \\n \\n\\nwith child as (\\n select customer_id as from_field\\n from acme.jaffle_shop.orders\\n where customer_id is not null\\n),\\n\\nparent as (\\n select customer_id as to_field\\n from acme.jaffle_shop.stg_customers\\n)\\n\\nselect\\n from_field\\n\\nfrom child\\nleft join parent\\n on child.from_field = parent.to_field\\n\\nwhere parent.to_field is null\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nwith child as (\\n select customer_id as from_field\\n from acme.jaffle_shop.orders\\n where customer_id is not null\\n),\\n\\nparent as (\\n select customer_id as to_field\\n from acme.jaffle_shop.stg_customers\\n)\\n\\nselect\\n from_field\\n\\nfrom child\\nleft join parent\\n on child.from_field = parent.to_field\\n\\nwhere parent.to_field is null\\n\\n\\n", + "compiledSql": "\n \n \n\nwith child as (\n select customer_id as from_field\n from acme.jaffle_shop.orders\n where customer_id is not null\n),\n\nparent as (\n select customer_id as to_field\n from acme.jaffle_shop.stg_customers\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", + "compiledCode": "\n \n \n\nwith child as (\n select customer_id as from_field\n from acme.jaffle_shop.orders\n where customer_id is not null\n),\n\nparent as (\n select customer_id as to_field\n from acme.jaffle_shop.stg_customers\n)\n\nselect\n from_field\n\nfrom child\nleft join parent\n on child.from_field = parent.to_field\n\nwhere parent.to_field is null\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_relationships", @@ -120,103 +138,121 @@ "model.jaffle_shop.stg_customers" ], "name": "relationships_orders_customer_id__customer_id__ref_stg_customers_", - "uniqueId": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16" + "uniqueId": "test.jaffle_shop.relationships_orders_customer_id__customer_id__ref_stg_customers_.918495ce16", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.468Z" }, { "columnName": "customer_id", - "compiledSql": "\\n \\n \\n\\nselect\\n customer_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.customers\\nwhere customer_id is not null\\ngroup by customer_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n customer_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.customers\\nwhere customer_id is not null\\ngroup by customer_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.customers\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.customers\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.customers" ], "name": "unique_customers_customer_id", - "uniqueId": "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1" + "uniqueId": "test.jaffle_shop.unique_customers_customer_id.c5af1ff4b1", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.370Z" }, { "columnName": "order_id", - "compiledSql": "\\n \\n \\n\\nselect\\n order_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.orders\\nwhere order_id is not null\\ngroup by order_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n order_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.orders\\nwhere order_id is not null\\ngroup by order_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.orders\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.orders\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.orders" ], "name": "unique_orders_order_id", - "uniqueId": "test.jaffle_shop.unique_orders_order_id.fed79b3a6e" + "uniqueId": "test.jaffle_shop.unique_orders_order_id.fed79b3a6e", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.470Z" }, { "columnName": "customer_id", - "compiledSql": "\\n \\n \\n\\nselect\\n customer_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_customers\\nwhere customer_id is not null\\ngroup by customer_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n customer_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_customers\\nwhere customer_id is not null\\ngroup by customer_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_customers\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n customer_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_customers\nwhere customer_id is not null\ngroup by customer_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.stg_customers" ], "name": "unique_stg_customers_customer_id", - "uniqueId": "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada" + "uniqueId": "test.jaffle_shop.unique_stg_customers_customer_id.c7614daada", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.520Z" }, { "columnName": "location_id", - "compiledSql": "\\n \\n \\n\\nselect\\n location_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_locations\\nwhere location_id is not null\\ngroup by location_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n location_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_locations\\nwhere location_id is not null\\ngroup by location_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_locations\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n location_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_locations\nwhere location_id is not null\ngroup by location_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.stg_locations" ], "name": "unique_stg_locations_location_id", - "uniqueId": "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc" + "uniqueId": "test.jaffle_shop.unique_stg_locations_location_id.2e2fc58ecc", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.541Z" }, { "columnName": "order_item_id", - "compiledSql": "\\n \\n \\n\\nselect\\n order_item_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_order_items\\nwhere order_item_id is not null\\ngroup by order_item_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n order_item_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_order_items\\nwhere order_item_id is not null\\ngroup by order_item_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_order_items\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n order_item_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_order_items\nwhere order_item_id is not null\ngroup by order_item_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.stg_order_items" ], "name": "unique_stg_order_items_order_item_id", - "uniqueId": "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108" + "uniqueId": "test.jaffle_shop.unique_stg_order_items_order_item_id.90e333a108", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.659Z" }, { "columnName": "order_id", - "compiledSql": "\\n \\n \\n\\nselect\\n order_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_orders\\nwhere order_id is not null\\ngroup by order_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n order_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_orders\\nwhere order_id is not null\\ngroup by order_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_orders\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n order_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_orders\nwhere order_id is not null\ngroup by order_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.stg_orders" ], "name": "unique_stg_orders_order_id", - "uniqueId": "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a" + "uniqueId": "test.jaffle_shop.unique_stg_orders_order_id.e3b841c71a", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.663Z" }, { "columnName": "product_id", - "compiledSql": "\\n \\n \\n\\nselect\\n product_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_products\\nwhere product_id is not null\\ngroup by product_id\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n product_id as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_products\\nwhere product_id is not null\\ngroup by product_id\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n product_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_products\nwhere product_id is not null\ngroup by product_id\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n product_id as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_products\nwhere product_id is not null\ngroup by product_id\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.stg_products" ], "name": "unique_stg_products_product_id", - "uniqueId": "test.jaffle_shop.unique_stg_products_product_id.7d950a1467" + "uniqueId": "test.jaffle_shop.unique_stg_products_product_id.7d950a1467", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.681Z" }, { "columnName": "supply_uuid", - "compiledSql": "\\n \\n \\n\\nselect\\n supply_uuid as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_supplies\\nwhere supply_uuid is not null\\ngroup by supply_uuid\\nhaving count(*) > 1\\n\\n\\n", - "compiledCode": "\\n \\n \\n\\nselect\\n supply_uuid as unique_field,\\n count(*) as n_records\\n\\nfrom acme.jaffle_shop.stg_supplies\\nwhere supply_uuid is not null\\ngroup by supply_uuid\\nhaving count(*) > 1\\n\\n\\n", + "compiledSql": "\n \n \n\nselect\n supply_uuid as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_supplies\nwhere supply_uuid is not null\ngroup by supply_uuid\nhaving count(*) > 1\n\n\n", + "compiledCode": "\n \n \n\nselect\n supply_uuid as unique_field,\n count(*) as n_records\n\nfrom acme.jaffle_shop.stg_supplies\nwhere supply_uuid is not null\ngroup by supply_uuid\nhaving count(*) > 1\n\n\n", "dependsOn": [ "macro.dbt.get_where_subquery", "macro.dbt.test_unique", "model.jaffle_shop.stg_supplies" ], "name": "unique_stg_supplies_supply_uuid", - "uniqueId": "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed" + "uniqueId": "test.jaffle_shop.unique_stg_supplies_supply_uuid.c9e3edcfed", + "status": "pass", + "executeCompletedAt": "2024-08-23T04:01:33.720Z" } ] } diff --git a/tests/dbt/cloud/test_dbt_test_parser.py b/tests/dbt/cloud/test_dbt_test_parser.py index acb90abf..2fc9f530 100644 --- a/tests/dbt/cloud/test_dbt_test_parser.py +++ b/tests/dbt/cloud/test_dbt_test_parser.py @@ -1,4 +1,4 @@ -import datetime +from datetime import datetime, timezone from typing import Dict from metaphor.dbt.cloud.discovery_api.generated.get_job_run_models import ( @@ -39,6 +39,8 @@ def test_dbt_test_parser(): compiledCode="compiledCode", compiledSql="compiledSql", columnName="column", + status="warn", + executeCompletedAt=datetime(2000, 1, 2, tzinfo=timezone.utc), ) # No depends_on - nothing @@ -66,7 +68,7 @@ def test_dbt_test_parser(): runResults=[ RunResult( status="pass", - executeCompletedAt=datetime.datetime.now(), + executeCompletedAt=datetime.now(), ), ], alias=None,