dvt-core 0.58.6__cp311-cp311-macosx_10_9_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dbt/__init__.py +7 -0
- dbt/_pydantic_shim.py +26 -0
- dbt/artifacts/__init__.py +0 -0
- dbt/artifacts/exceptions/__init__.py +1 -0
- dbt/artifacts/exceptions/schemas.py +31 -0
- dbt/artifacts/resources/__init__.py +116 -0
- dbt/artifacts/resources/base.py +67 -0
- dbt/artifacts/resources/types.py +93 -0
- dbt/artifacts/resources/v1/analysis.py +10 -0
- dbt/artifacts/resources/v1/catalog.py +23 -0
- dbt/artifacts/resources/v1/components.py +274 -0
- dbt/artifacts/resources/v1/config.py +277 -0
- dbt/artifacts/resources/v1/documentation.py +11 -0
- dbt/artifacts/resources/v1/exposure.py +51 -0
- dbt/artifacts/resources/v1/function.py +52 -0
- dbt/artifacts/resources/v1/generic_test.py +31 -0
- dbt/artifacts/resources/v1/group.py +21 -0
- dbt/artifacts/resources/v1/hook.py +11 -0
- dbt/artifacts/resources/v1/macro.py +29 -0
- dbt/artifacts/resources/v1/metric.py +172 -0
- dbt/artifacts/resources/v1/model.py +145 -0
- dbt/artifacts/resources/v1/owner.py +10 -0
- dbt/artifacts/resources/v1/saved_query.py +111 -0
- dbt/artifacts/resources/v1/seed.py +41 -0
- dbt/artifacts/resources/v1/semantic_layer_components.py +72 -0
- dbt/artifacts/resources/v1/semantic_model.py +314 -0
- dbt/artifacts/resources/v1/singular_test.py +14 -0
- dbt/artifacts/resources/v1/snapshot.py +91 -0
- dbt/artifacts/resources/v1/source_definition.py +84 -0
- dbt/artifacts/resources/v1/sql_operation.py +10 -0
- dbt/artifacts/resources/v1/unit_test_definition.py +77 -0
- dbt/artifacts/schemas/__init__.py +0 -0
- dbt/artifacts/schemas/base.py +191 -0
- dbt/artifacts/schemas/batch_results.py +24 -0
- dbt/artifacts/schemas/catalog/__init__.py +11 -0
- dbt/artifacts/schemas/catalog/v1/__init__.py +0 -0
- dbt/artifacts/schemas/catalog/v1/catalog.py +59 -0
- dbt/artifacts/schemas/freshness/__init__.py +1 -0
- dbt/artifacts/schemas/freshness/v3/__init__.py +0 -0
- dbt/artifacts/schemas/freshness/v3/freshness.py +158 -0
- dbt/artifacts/schemas/manifest/__init__.py +2 -0
- dbt/artifacts/schemas/manifest/v12/__init__.py +0 -0
- dbt/artifacts/schemas/manifest/v12/manifest.py +211 -0
- dbt/artifacts/schemas/results.py +147 -0
- dbt/artifacts/schemas/run/__init__.py +2 -0
- dbt/artifacts/schemas/run/v5/__init__.py +0 -0
- dbt/artifacts/schemas/run/v5/run.py +184 -0
- dbt/artifacts/schemas/upgrades/__init__.py +4 -0
- dbt/artifacts/schemas/upgrades/upgrade_manifest.py +174 -0
- dbt/artifacts/schemas/upgrades/upgrade_manifest_dbt_version.py +2 -0
- dbt/artifacts/utils/validation.py +153 -0
- dbt/cli/__init__.py +1 -0
- dbt/cli/context.py +17 -0
- dbt/cli/exceptions.py +57 -0
- dbt/cli/flags.py +560 -0
- dbt/cli/main.py +2403 -0
- dbt/cli/option_types.py +121 -0
- dbt/cli/options.py +80 -0
- dbt/cli/params.py +844 -0
- dbt/cli/requires.py +490 -0
- dbt/cli/resolvers.py +50 -0
- dbt/cli/types.py +40 -0
- dbt/clients/__init__.py +0 -0
- dbt/clients/checked_load.py +83 -0
- dbt/clients/git.py +164 -0
- dbt/clients/jinja.py +206 -0
- dbt/clients/jinja_static.py +245 -0
- dbt/clients/registry.py +192 -0
- dbt/clients/yaml_helper.py +68 -0
- dbt/compilation.py +876 -0
- dbt/compute/__init__.py +14 -0
- dbt/compute/engines/__init__.py +12 -0
- dbt/compute/engines/spark_engine.cpython-311-darwin.so +0 -0
- dbt/compute/engines/spark_engine.py +642 -0
- dbt/compute/federated_executor.cpython-311-darwin.so +0 -0
- dbt/compute/federated_executor.py +1080 -0
- dbt/compute/filter_pushdown.cpython-311-darwin.so +0 -0
- dbt/compute/filter_pushdown.py +273 -0
- dbt/compute/jar_provisioning.cpython-311-darwin.so +0 -0
- dbt/compute/jar_provisioning.py +255 -0
- dbt/compute/java_compat.cpython-311-darwin.so +0 -0
- dbt/compute/java_compat.py +689 -0
- dbt/compute/jdbc_utils.cpython-311-darwin.so +0 -0
- dbt/compute/jdbc_utils.py +678 -0
- dbt/compute/metadata/__init__.py +40 -0
- dbt/compute/metadata/adapters_registry.cpython-311-darwin.so +0 -0
- dbt/compute/metadata/adapters_registry.py +370 -0
- dbt/compute/metadata/registry.cpython-311-darwin.so +0 -0
- dbt/compute/metadata/registry.py +674 -0
- dbt/compute/metadata/store.cpython-311-darwin.so +0 -0
- dbt/compute/metadata/store.py +1499 -0
- dbt/compute/smart_selector.cpython-311-darwin.so +0 -0
- dbt/compute/smart_selector.py +377 -0
- dbt/compute/strategies/__init__.py +55 -0
- dbt/compute/strategies/base.cpython-311-darwin.so +0 -0
- dbt/compute/strategies/base.py +165 -0
- dbt/compute/strategies/dataproc.cpython-311-darwin.so +0 -0
- dbt/compute/strategies/dataproc.py +207 -0
- dbt/compute/strategies/emr.cpython-311-darwin.so +0 -0
- dbt/compute/strategies/emr.py +203 -0
- dbt/compute/strategies/local.cpython-311-darwin.so +0 -0
- dbt/compute/strategies/local.py +443 -0
- dbt/compute/strategies/standalone.cpython-311-darwin.so +0 -0
- dbt/compute/strategies/standalone.py +262 -0
- dbt/config/__init__.py +4 -0
- dbt/config/catalogs.py +94 -0
- dbt/config/compute.cpython-311-darwin.so +0 -0
- dbt/config/compute.py +513 -0
- dbt/config/dvt_profile.cpython-311-darwin.so +0 -0
- dbt/config/dvt_profile.py +342 -0
- dbt/config/profile.py +422 -0
- dbt/config/project.py +873 -0
- dbt/config/project_utils.py +28 -0
- dbt/config/renderer.py +231 -0
- dbt/config/runtime.py +553 -0
- dbt/config/selectors.py +208 -0
- dbt/config/utils.py +77 -0
- dbt/constants.py +28 -0
- dbt/context/__init__.py +0 -0
- dbt/context/base.py +745 -0
- dbt/context/configured.py +135 -0
- dbt/context/context_config.py +382 -0
- dbt/context/docs.py +82 -0
- dbt/context/exceptions_jinja.py +178 -0
- dbt/context/macro_resolver.py +195 -0
- dbt/context/macros.py +171 -0
- dbt/context/manifest.py +72 -0
- dbt/context/providers.py +2249 -0
- dbt/context/query_header.py +13 -0
- dbt/context/secret.py +58 -0
- dbt/context/target.py +74 -0
- dbt/contracts/__init__.py +0 -0
- dbt/contracts/files.py +413 -0
- dbt/contracts/graph/__init__.py +0 -0
- dbt/contracts/graph/manifest.py +1904 -0
- dbt/contracts/graph/metrics.py +97 -0
- dbt/contracts/graph/model_config.py +70 -0
- dbt/contracts/graph/node_args.py +42 -0
- dbt/contracts/graph/nodes.py +1806 -0
- dbt/contracts/graph/semantic_manifest.py +232 -0
- dbt/contracts/graph/unparsed.py +811 -0
- dbt/contracts/project.py +417 -0
- dbt/contracts/results.py +53 -0
- dbt/contracts/selection.py +23 -0
- dbt/contracts/sql.py +85 -0
- dbt/contracts/state.py +68 -0
- dbt/contracts/util.py +46 -0
- dbt/deprecations.py +348 -0
- dbt/deps/__init__.py +0 -0
- dbt/deps/base.py +152 -0
- dbt/deps/git.py +195 -0
- dbt/deps/local.py +79 -0
- dbt/deps/registry.py +130 -0
- dbt/deps/resolver.py +149 -0
- dbt/deps/tarball.py +120 -0
- dbt/docs/source/_ext/dbt_click.py +119 -0
- dbt/docs/source/conf.py +32 -0
- dbt/env_vars.py +64 -0
- dbt/event_time/event_time.py +40 -0
- dbt/event_time/sample_window.py +60 -0
- dbt/events/__init__.py +15 -0
- dbt/events/base_types.py +36 -0
- dbt/events/core_types_pb2.py +2 -0
- dbt/events/logging.py +108 -0
- dbt/events/types.py +2516 -0
- dbt/exceptions.py +1486 -0
- dbt/flags.py +89 -0
- dbt/graph/__init__.py +11 -0
- dbt/graph/cli.py +249 -0
- dbt/graph/graph.py +172 -0
- dbt/graph/queue.py +214 -0
- dbt/graph/selector.py +374 -0
- dbt/graph/selector_methods.py +975 -0
- dbt/graph/selector_spec.py +222 -0
- dbt/graph/thread_pool.py +18 -0
- dbt/hooks.py +21 -0
- dbt/include/README.md +49 -0
- dbt/include/__init__.py +3 -0
- dbt/include/data/adapters_registry.duckdb +0 -0
- dbt/include/data/build_registry.py +242 -0
- dbt/include/data/csv/adapter_queries.csv +33 -0
- dbt/include/data/csv/syntax_rules.csv +9 -0
- dbt/include/data/csv/type_mappings_bigquery.csv +28 -0
- dbt/include/data/csv/type_mappings_databricks.csv +30 -0
- dbt/include/data/csv/type_mappings_mysql.csv +40 -0
- dbt/include/data/csv/type_mappings_oracle.csv +30 -0
- dbt/include/data/csv/type_mappings_postgres.csv +56 -0
- dbt/include/data/csv/type_mappings_redshift.csv +33 -0
- dbt/include/data/csv/type_mappings_snowflake.csv +38 -0
- dbt/include/data/csv/type_mappings_sqlserver.csv +35 -0
- dbt/include/starter_project/.gitignore +4 -0
- dbt/include/starter_project/README.md +15 -0
- dbt/include/starter_project/__init__.py +3 -0
- dbt/include/starter_project/analyses/.gitkeep +0 -0
- dbt/include/starter_project/dbt_project.yml +36 -0
- dbt/include/starter_project/macros/.gitkeep +0 -0
- dbt/include/starter_project/models/example/my_first_dbt_model.sql +27 -0
- dbt/include/starter_project/models/example/my_second_dbt_model.sql +6 -0
- dbt/include/starter_project/models/example/schema.yml +21 -0
- dbt/include/starter_project/seeds/.gitkeep +0 -0
- dbt/include/starter_project/snapshots/.gitkeep +0 -0
- dbt/include/starter_project/tests/.gitkeep +0 -0
- dbt/internal_deprecations.py +26 -0
- dbt/jsonschemas/__init__.py +3 -0
- dbt/jsonschemas/jsonschemas.py +309 -0
- dbt/jsonschemas/project/0.0.110.json +4717 -0
- dbt/jsonschemas/project/0.0.85.json +2015 -0
- dbt/jsonschemas/resources/0.0.110.json +2636 -0
- dbt/jsonschemas/resources/0.0.85.json +2536 -0
- dbt/jsonschemas/resources/latest.json +6773 -0
- dbt/links.py +4 -0
- dbt/materializations/__init__.py +0 -0
- dbt/materializations/incremental/__init__.py +0 -0
- dbt/materializations/incremental/microbatch.py +236 -0
- dbt/mp_context.py +8 -0
- dbt/node_types.py +37 -0
- dbt/parser/__init__.py +23 -0
- dbt/parser/analysis.py +21 -0
- dbt/parser/base.py +548 -0
- dbt/parser/common.py +266 -0
- dbt/parser/docs.py +52 -0
- dbt/parser/fixtures.py +51 -0
- dbt/parser/functions.py +30 -0
- dbt/parser/generic_test.py +100 -0
- dbt/parser/generic_test_builders.py +333 -0
- dbt/parser/hooks.py +118 -0
- dbt/parser/macros.py +137 -0
- dbt/parser/manifest.py +2204 -0
- dbt/parser/models.py +573 -0
- dbt/parser/partial.py +1178 -0
- dbt/parser/read_files.py +445 -0
- dbt/parser/schema_generic_tests.py +422 -0
- dbt/parser/schema_renderer.py +111 -0
- dbt/parser/schema_yaml_readers.py +935 -0
- dbt/parser/schemas.py +1466 -0
- dbt/parser/search.py +149 -0
- dbt/parser/seeds.py +28 -0
- dbt/parser/singular_test.py +20 -0
- dbt/parser/snapshots.py +44 -0
- dbt/parser/sources.py +558 -0
- dbt/parser/sql.py +62 -0
- dbt/parser/unit_tests.py +621 -0
- dbt/plugins/__init__.py +20 -0
- dbt/plugins/contracts.py +9 -0
- dbt/plugins/exceptions.py +2 -0
- dbt/plugins/manager.py +163 -0
- dbt/plugins/manifest.py +21 -0
- dbt/profiler.py +20 -0
- dbt/py.typed +1 -0
- dbt/query_analyzer.cpython-311-darwin.so +0 -0
- dbt/query_analyzer.py +410 -0
- dbt/runners/__init__.py +2 -0
- dbt/runners/exposure_runner.py +7 -0
- dbt/runners/no_op_runner.py +45 -0
- dbt/runners/saved_query_runner.py +7 -0
- dbt/selected_resources.py +8 -0
- dbt/task/__init__.py +0 -0
- dbt/task/base.py +503 -0
- dbt/task/build.py +197 -0
- dbt/task/clean.py +56 -0
- dbt/task/clone.py +161 -0
- dbt/task/compile.py +150 -0
- dbt/task/compute.cpython-311-darwin.so +0 -0
- dbt/task/compute.py +458 -0
- dbt/task/debug.py +505 -0
- dbt/task/deps.py +280 -0
- dbt/task/docs/__init__.py +3 -0
- dbt/task/docs/api/__init__.py +23 -0
- dbt/task/docs/api/catalog.cpython-311-darwin.so +0 -0
- dbt/task/docs/api/catalog.py +204 -0
- dbt/task/docs/api/lineage.cpython-311-darwin.so +0 -0
- dbt/task/docs/api/lineage.py +234 -0
- dbt/task/docs/api/profile.cpython-311-darwin.so +0 -0
- dbt/task/docs/api/profile.py +204 -0
- dbt/task/docs/api/spark.cpython-311-darwin.so +0 -0
- dbt/task/docs/api/spark.py +186 -0
- dbt/task/docs/generate.py +947 -0
- dbt/task/docs/index.html +250 -0
- dbt/task/docs/serve.cpython-311-darwin.so +0 -0
- dbt/task/docs/serve.py +174 -0
- dbt/task/dvt_output.py +362 -0
- dbt/task/dvt_run.py +204 -0
- dbt/task/freshness.py +322 -0
- dbt/task/function.py +121 -0
- dbt/task/group_lookup.py +46 -0
- dbt/task/init.cpython-311-darwin.so +0 -0
- dbt/task/init.py +604 -0
- dbt/task/java.cpython-311-darwin.so +0 -0
- dbt/task/java.py +316 -0
- dbt/task/list.py +236 -0
- dbt/task/metadata.cpython-311-darwin.so +0 -0
- dbt/task/metadata.py +804 -0
- dbt/task/printer.py +175 -0
- dbt/task/profile.cpython-311-darwin.so +0 -0
- dbt/task/profile.py +1307 -0
- dbt/task/profile_serve.py +615 -0
- dbt/task/retract.py +438 -0
- dbt/task/retry.py +175 -0
- dbt/task/run.py +1387 -0
- dbt/task/run_operation.py +141 -0
- dbt/task/runnable.py +758 -0
- dbt/task/seed.py +103 -0
- dbt/task/show.py +149 -0
- dbt/task/snapshot.py +56 -0
- dbt/task/spark.cpython-311-darwin.so +0 -0
- dbt/task/spark.py +414 -0
- dbt/task/sql.py +110 -0
- dbt/task/target_sync.cpython-311-darwin.so +0 -0
- dbt/task/target_sync.py +766 -0
- dbt/task/test.py +464 -0
- dbt/tests/fixtures/__init__.py +1 -0
- dbt/tests/fixtures/project.py +620 -0
- dbt/tests/util.py +651 -0
- dbt/tracking.py +529 -0
- dbt/utils/__init__.py +3 -0
- dbt/utils/artifact_upload.py +151 -0
- dbt/utils/utils.py +408 -0
- dbt/version.py +270 -0
- dvt_cli/__init__.py +72 -0
- dvt_core-0.58.6.dist-info/METADATA +288 -0
- dvt_core-0.58.6.dist-info/RECORD +324 -0
- dvt_core-0.58.6.dist-info/WHEEL +5 -0
- dvt_core-0.58.6.dist-info/entry_points.txt +2 -0
- dvt_core-0.58.6.dist-info/top_level.txt +2 -0
dbt/__init__.py
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# N.B.
|
|
2
|
+
# This will add to the package’s __path__ all subdirectories of directories on sys.path named after the package which effectively combines both modules into a single namespace (dbt.adapters)
|
|
3
|
+
# The matching statement is in plugins/postgres/dbt/__init__.py
|
|
4
|
+
|
|
5
|
+
from pkgutil import extend_path
|
|
6
|
+
|
|
7
|
+
__path__ = extend_path(__path__, __name__)
|
dbt/_pydantic_shim.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# type: ignore
|
|
2
|
+
|
|
3
|
+
"""Shim to allow support for both Pydantic 1 and Pydantic 2.
|
|
4
|
+
|
|
5
|
+
dbt-core must support both major versions of Pydantic because dbt-core users might be using an environment with
|
|
6
|
+
either version, and we can't restrict them to one or the other. Here, we essentially import all Pydantic objects
|
|
7
|
+
from version 1 that we use. Throughout the repo, we import these objects from this file instead of from Pydantic
|
|
8
|
+
directly, meaning that we essentially only use Pydantic 1 in dbt-core currently, but without forcing that restriction
|
|
9
|
+
on dbt users. The development environment for this repo should be pinned to Pydantic 1 to ensure devs get appropriate
|
|
10
|
+
type hints.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from importlib.metadata import version
|
|
14
|
+
|
|
15
|
+
pydantic_version = version("pydantic")
|
|
16
|
+
# Pydantic uses semantic versioning, i.e. <major>.<minor>.<patch>, and we need to know the major
|
|
17
|
+
pydantic_major = pydantic_version.split(".")[0]
|
|
18
|
+
|
|
19
|
+
if pydantic_major == "1":
|
|
20
|
+
from pydantic import BaseSettings # noqa: F401
|
|
21
|
+
elif pydantic_major == "2":
|
|
22
|
+
from pydantic.v1 import BaseSettings # noqa: F401
|
|
23
|
+
else:
|
|
24
|
+
raise RuntimeError(
|
|
25
|
+
f"Currently only pydantic 1 and 2 are supported, found pydantic {pydantic_version}"
|
|
26
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from dbt.artifacts.exceptions.schemas import IncompatibleSchemaError
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
3
|
+
from dbt_common.exceptions import DbtRuntimeError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class IncompatibleSchemaError(DbtRuntimeError):
|
|
7
|
+
def __init__(self, expected: str, found: Optional[str] = None) -> None:
|
|
8
|
+
self.expected = expected
|
|
9
|
+
self.found = found
|
|
10
|
+
self.filename = "input file"
|
|
11
|
+
|
|
12
|
+
super().__init__(msg=self.get_message())
|
|
13
|
+
|
|
14
|
+
def add_filename(self, filename: str):
|
|
15
|
+
self.filename = filename
|
|
16
|
+
self.msg = self.get_message()
|
|
17
|
+
|
|
18
|
+
def get_message(self) -> str:
|
|
19
|
+
found_str = "nothing"
|
|
20
|
+
if self.found is not None:
|
|
21
|
+
found_str = f'"{self.found}"'
|
|
22
|
+
|
|
23
|
+
msg = (
|
|
24
|
+
f'Expected a schema version of "{self.expected}" in '
|
|
25
|
+
f"{self.filename}, but found {found_str}. Are you running with a "
|
|
26
|
+
f"different version of dbt?"
|
|
27
|
+
)
|
|
28
|
+
return msg
|
|
29
|
+
|
|
30
|
+
CODE = 10014
|
|
31
|
+
MESSAGE = "Incompatible Schema"
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
from dbt.artifacts.resources.base import BaseResource, Docs, FileHash, GraphResource
|
|
2
|
+
from dbt.artifacts.resources.v1.analysis import Analysis
|
|
3
|
+
from dbt.artifacts.resources.v1.catalog import Catalog, CatalogWriteIntegrationConfig
|
|
4
|
+
|
|
5
|
+
# alias to latest resource definitions
|
|
6
|
+
from dbt.artifacts.resources.v1.components import (
|
|
7
|
+
ColumnConfig,
|
|
8
|
+
ColumnInfo,
|
|
9
|
+
CompiledResource,
|
|
10
|
+
Contract,
|
|
11
|
+
DeferRelation,
|
|
12
|
+
DependsOn,
|
|
13
|
+
FreshnessThreshold,
|
|
14
|
+
HasRelationMetadata,
|
|
15
|
+
InjectedCTE,
|
|
16
|
+
NodeVersion,
|
|
17
|
+
ParsedResource,
|
|
18
|
+
ParsedResourceMandatory,
|
|
19
|
+
Quoting,
|
|
20
|
+
RefArgs,
|
|
21
|
+
Time,
|
|
22
|
+
)
|
|
23
|
+
from dbt.artifacts.resources.v1.config import (
|
|
24
|
+
Hook,
|
|
25
|
+
NodeAndTestConfig,
|
|
26
|
+
NodeConfig,
|
|
27
|
+
TestConfig,
|
|
28
|
+
list_str,
|
|
29
|
+
metas,
|
|
30
|
+
)
|
|
31
|
+
from dbt.artifacts.resources.v1.documentation import Documentation
|
|
32
|
+
from dbt.artifacts.resources.v1.exposure import (
|
|
33
|
+
Exposure,
|
|
34
|
+
ExposureConfig,
|
|
35
|
+
ExposureType,
|
|
36
|
+
MaturityType,
|
|
37
|
+
)
|
|
38
|
+
from dbt.artifacts.resources.v1.function import (
|
|
39
|
+
Function,
|
|
40
|
+
FunctionArgument,
|
|
41
|
+
FunctionConfig,
|
|
42
|
+
FunctionMandatory,
|
|
43
|
+
FunctionReturns,
|
|
44
|
+
)
|
|
45
|
+
from dbt.artifacts.resources.v1.generic_test import GenericTest, TestMetadata
|
|
46
|
+
from dbt.artifacts.resources.v1.group import Group, GroupConfig
|
|
47
|
+
from dbt.artifacts.resources.v1.hook import HookNode
|
|
48
|
+
from dbt.artifacts.resources.v1.macro import Macro, MacroArgument, MacroDependsOn
|
|
49
|
+
from dbt.artifacts.resources.v1.metric import (
|
|
50
|
+
ConstantPropertyInput,
|
|
51
|
+
ConversionTypeParams,
|
|
52
|
+
CumulativeTypeParams,
|
|
53
|
+
Metric,
|
|
54
|
+
MetricAggregationParams,
|
|
55
|
+
MetricConfig,
|
|
56
|
+
MetricInput,
|
|
57
|
+
MetricInputMeasure,
|
|
58
|
+
MetricTimeWindow,
|
|
59
|
+
MetricTypeParams,
|
|
60
|
+
)
|
|
61
|
+
from dbt.artifacts.resources.v1.model import (
|
|
62
|
+
CustomGranularity,
|
|
63
|
+
Model,
|
|
64
|
+
ModelConfig,
|
|
65
|
+
ModelFreshness,
|
|
66
|
+
TimeSpine,
|
|
67
|
+
)
|
|
68
|
+
from dbt.artifacts.resources.v1.owner import Owner
|
|
69
|
+
from dbt.artifacts.resources.v1.saved_query import (
|
|
70
|
+
Export,
|
|
71
|
+
ExportConfig,
|
|
72
|
+
QueryParams,
|
|
73
|
+
SavedQuery,
|
|
74
|
+
SavedQueryConfig,
|
|
75
|
+
SavedQueryMandatory,
|
|
76
|
+
)
|
|
77
|
+
from dbt.artifacts.resources.v1.seed import Seed, SeedConfig
|
|
78
|
+
from dbt.artifacts.resources.v1.semantic_layer_components import (
|
|
79
|
+
FileSlice,
|
|
80
|
+
MeasureAggregationParameters,
|
|
81
|
+
NonAdditiveDimension,
|
|
82
|
+
SourceFileMetadata,
|
|
83
|
+
WhereFilter,
|
|
84
|
+
WhereFilterIntersection,
|
|
85
|
+
)
|
|
86
|
+
from dbt.artifacts.resources.v1.semantic_model import (
|
|
87
|
+
Defaults,
|
|
88
|
+
Dimension,
|
|
89
|
+
DimensionTypeParams,
|
|
90
|
+
DimensionValidityParams,
|
|
91
|
+
Entity,
|
|
92
|
+
Measure,
|
|
93
|
+
NodeRelation,
|
|
94
|
+
SemanticLayerElementConfig,
|
|
95
|
+
SemanticModel,
|
|
96
|
+
SemanticModelConfig,
|
|
97
|
+
)
|
|
98
|
+
from dbt.artifacts.resources.v1.singular_test import SingularTest
|
|
99
|
+
from dbt.artifacts.resources.v1.snapshot import Snapshot, SnapshotConfig
|
|
100
|
+
from dbt.artifacts.resources.v1.source_definition import (
|
|
101
|
+
ExternalPartition,
|
|
102
|
+
ExternalTable,
|
|
103
|
+
ParsedSourceMandatory,
|
|
104
|
+
SourceConfig,
|
|
105
|
+
SourceDefinition,
|
|
106
|
+
)
|
|
107
|
+
from dbt.artifacts.resources.v1.sql_operation import SqlOperation
|
|
108
|
+
from dbt.artifacts.resources.v1.unit_test_definition import (
|
|
109
|
+
UnitTestConfig,
|
|
110
|
+
UnitTestDefinition,
|
|
111
|
+
UnitTestFormat,
|
|
112
|
+
UnitTestInputFixture,
|
|
113
|
+
UnitTestNodeVersions,
|
|
114
|
+
UnitTestOutputFixture,
|
|
115
|
+
UnitTestOverrides,
|
|
116
|
+
)
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import hashlib
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
|
|
5
|
+
from dbt.artifacts.resources.types import NodeType
|
|
6
|
+
from dbt_common.dataclass_schema import dbtClassMixin
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class BaseResource(dbtClassMixin):
|
|
11
|
+
name: str
|
|
12
|
+
resource_type: NodeType
|
|
13
|
+
package_name: str
|
|
14
|
+
path: str
|
|
15
|
+
original_file_path: str
|
|
16
|
+
unique_id: str
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class GraphResource(BaseResource):
|
|
21
|
+
fqn: List[str]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass
|
|
25
|
+
class FileHash(dbtClassMixin):
|
|
26
|
+
name: str # the hash type name
|
|
27
|
+
checksum: str # the hashlib.hash_type().hexdigest() of the file contents
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def empty(cls):
|
|
31
|
+
return FileHash(name="none", checksum="")
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def path(cls, path: str):
|
|
35
|
+
return FileHash(name="path", checksum=path)
|
|
36
|
+
|
|
37
|
+
def __eq__(self, other):
|
|
38
|
+
if not isinstance(other, FileHash):
|
|
39
|
+
return NotImplemented
|
|
40
|
+
|
|
41
|
+
if self.name == "none" or self.name != other.name:
|
|
42
|
+
return False
|
|
43
|
+
|
|
44
|
+
return self.checksum == other.checksum
|
|
45
|
+
|
|
46
|
+
def compare(self, contents: str) -> bool:
|
|
47
|
+
"""Compare the file contents with the given hash"""
|
|
48
|
+
if self.name == "none":
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
return self.from_contents(contents, name=self.name) == self.checksum
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_contents(cls, contents: str, name="sha256") -> "FileHash":
|
|
55
|
+
"""Create a file hash from the given file contents. The hash is always
|
|
56
|
+
the utf-8 encoding of the contents given, because dbt only reads files
|
|
57
|
+
as utf-8.
|
|
58
|
+
"""
|
|
59
|
+
data = contents.encode("utf-8")
|
|
60
|
+
checksum = hashlib.new(name, data).hexdigest()
|
|
61
|
+
return cls(name=name, checksum=checksum)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass
|
|
65
|
+
class Docs(dbtClassMixin):
|
|
66
|
+
show: bool = True
|
|
67
|
+
node_color: Optional[str] = None
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from dbt_common.dataclass_schema import StrEnum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AccessType(StrEnum):
|
|
5
|
+
Private = "private"
|
|
6
|
+
Protected = "protected"
|
|
7
|
+
Public = "public"
|
|
8
|
+
|
|
9
|
+
@classmethod
|
|
10
|
+
def is_valid(cls, item):
|
|
11
|
+
try:
|
|
12
|
+
cls(item)
|
|
13
|
+
except ValueError:
|
|
14
|
+
return False
|
|
15
|
+
return True
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class NodeType(StrEnum):
|
|
19
|
+
Model = "model"
|
|
20
|
+
Analysis = "analysis"
|
|
21
|
+
Test = "test" # renamed to 'data_test'; preserved as 'test' here for back-compat
|
|
22
|
+
Snapshot = "snapshot"
|
|
23
|
+
Operation = "operation"
|
|
24
|
+
Seed = "seed"
|
|
25
|
+
# TODO: rm?
|
|
26
|
+
RPCCall = "rpc"
|
|
27
|
+
SqlOperation = "sql_operation"
|
|
28
|
+
Documentation = "doc"
|
|
29
|
+
Source = "source"
|
|
30
|
+
Macro = "macro"
|
|
31
|
+
Exposure = "exposure"
|
|
32
|
+
Metric = "metric"
|
|
33
|
+
Group = "group"
|
|
34
|
+
SavedQuery = "saved_query"
|
|
35
|
+
SemanticModel = "semantic_model"
|
|
36
|
+
Unit = "unit_test"
|
|
37
|
+
Fixture = "fixture"
|
|
38
|
+
Function = "function"
|
|
39
|
+
|
|
40
|
+
def pluralize(self) -> str:
|
|
41
|
+
if self is self.Analysis:
|
|
42
|
+
return "analyses"
|
|
43
|
+
elif self is self.SavedQuery:
|
|
44
|
+
return "saved_queries"
|
|
45
|
+
elif self is self.Test:
|
|
46
|
+
return "data_tests"
|
|
47
|
+
return f"{self}s"
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class RunHookType(StrEnum):
|
|
51
|
+
Start = "on-run-start"
|
|
52
|
+
End = "on-run-end"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class ModelLanguage(StrEnum):
|
|
56
|
+
python = "python"
|
|
57
|
+
sql = "sql"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
class ModelHookType(StrEnum):
|
|
61
|
+
PreHook = "pre-hook"
|
|
62
|
+
PostHook = "post-hook"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class TimePeriod(StrEnum):
|
|
66
|
+
minute = "minute"
|
|
67
|
+
hour = "hour"
|
|
68
|
+
day = "day"
|
|
69
|
+
|
|
70
|
+
def plural(self) -> str:
|
|
71
|
+
return str(self) + "s"
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class BatchSize(StrEnum):
|
|
75
|
+
hour = "hour"
|
|
76
|
+
day = "day"
|
|
77
|
+
month = "month"
|
|
78
|
+
year = "year"
|
|
79
|
+
|
|
80
|
+
def plural(self) -> str:
|
|
81
|
+
return str(self) + "s"
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class FunctionType(StrEnum):
|
|
85
|
+
Scalar = "scalar"
|
|
86
|
+
Aggregate = "aggregate"
|
|
87
|
+
Table = "table"
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class FunctionVolatility(StrEnum):
|
|
91
|
+
Deterministic = "deterministic"
|
|
92
|
+
Stable = "stable"
|
|
93
|
+
NonDeterministic = "non-deterministic"
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Literal
|
|
3
|
+
|
|
4
|
+
from dbt.artifacts.resources.types import NodeType
|
|
5
|
+
from dbt.artifacts.resources.v1.components import CompiledResource
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class Analysis(CompiledResource):
|
|
10
|
+
resource_type: Literal[NodeType.Analysis]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from dataclasses import dataclass, field
|
|
2
|
+
from typing import Any, Dict, List, Optional
|
|
3
|
+
|
|
4
|
+
from dbt.adapters.catalogs import CatalogIntegrationConfig
|
|
5
|
+
from dbt_common.dataclass_schema import dbtClassMixin
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass
|
|
9
|
+
class CatalogWriteIntegrationConfig(CatalogIntegrationConfig):
|
|
10
|
+
name: str
|
|
11
|
+
catalog_type: str
|
|
12
|
+
external_volume: Optional[str] = None
|
|
13
|
+
table_format: Optional[str] = None
|
|
14
|
+
catalog_name: Optional[str] = None
|
|
15
|
+
file_format: Optional[str] = None
|
|
16
|
+
adapter_properties: Dict[str, Any] = field(default_factory=dict)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass
|
|
20
|
+
class Catalog(dbtClassMixin):
|
|
21
|
+
name: str
|
|
22
|
+
active_write_integration: Optional[str] = None
|
|
23
|
+
write_integrations: List[CatalogWriteIntegrationConfig] = field(default_factory=list)
|
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import time
|
|
2
|
+
from dataclasses import dataclass, field
|
|
3
|
+
from datetime import timedelta
|
|
4
|
+
from typing import Any, Dict, List, Optional, Union
|
|
5
|
+
|
|
6
|
+
from dbt.artifacts.resources.base import Docs, FileHash, GraphResource
|
|
7
|
+
from dbt.artifacts.resources.types import NodeType, TimePeriod
|
|
8
|
+
from dbt.artifacts.resources.v1.config import NodeConfig
|
|
9
|
+
from dbt_common.contracts.config.base import BaseConfig, MergeBehavior
|
|
10
|
+
from dbt_common.contracts.config.properties import AdditionalPropertiesMixin
|
|
11
|
+
from dbt_common.contracts.constraints import ColumnLevelConstraint
|
|
12
|
+
from dbt_common.contracts.util import Mergeable
|
|
13
|
+
from dbt_common.dataclass_schema import ExtensibleDbtClassMixin, dbtClassMixin
|
|
14
|
+
from dbt_semantic_interfaces.type_enums import TimeGranularity
|
|
15
|
+
|
|
16
|
+
NodeVersion = Union[str, float]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _backcompat_doc_blocks(doc_blocks: Any) -> List[str]:
|
|
20
|
+
"""
|
|
21
|
+
Make doc_blocks backwards-compatible for scenarios where a user specifies `doc_blocks` on a model or column.
|
|
22
|
+
Mashumaro will raise a serialization error if the specified `doc_blocks` isn't a list of strings.
|
|
23
|
+
In such a scenario, this method returns an empty list to avoid a serialization error.
|
|
24
|
+
Further along, `_get_doc_blocks` in `manifest.py` populates the correct `doc_blocks` for the happy path.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
if isinstance(doc_blocks, list) and all(isinstance(x, str) for x in doc_blocks):
|
|
28
|
+
return doc_blocks
|
|
29
|
+
|
|
30
|
+
return []
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass
|
|
34
|
+
class MacroDependsOn(dbtClassMixin):
|
|
35
|
+
macros: List[str] = field(default_factory=list)
|
|
36
|
+
|
|
37
|
+
# 'in' on lists is O(n) so this is O(n^2) for # of macros
|
|
38
|
+
def add_macro(self, value: str):
|
|
39
|
+
if value not in self.macros:
|
|
40
|
+
self.macros.append(value)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass
|
|
44
|
+
class DependsOn(MacroDependsOn):
|
|
45
|
+
nodes: List[str] = field(default_factory=list)
|
|
46
|
+
|
|
47
|
+
def add_node(self, value: str):
|
|
48
|
+
if value not in self.nodes:
|
|
49
|
+
self.nodes.append(value)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass
|
|
53
|
+
class RefArgs(dbtClassMixin):
|
|
54
|
+
name: str
|
|
55
|
+
package: Optional[str] = None
|
|
56
|
+
version: Optional[NodeVersion] = None
|
|
57
|
+
|
|
58
|
+
@property
|
|
59
|
+
def positional_args(self) -> List[str]:
|
|
60
|
+
if self.package:
|
|
61
|
+
return [self.package, self.name]
|
|
62
|
+
else:
|
|
63
|
+
return [self.name]
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def keyword_args(self) -> Dict[str, Optional[NodeVersion]]:
|
|
67
|
+
if self.version:
|
|
68
|
+
return {"version": self.version}
|
|
69
|
+
else:
|
|
70
|
+
return {}
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass
|
|
74
|
+
class ColumnConfig(BaseConfig):
|
|
75
|
+
meta: Dict[str, Any] = field(default_factory=dict, metadata=MergeBehavior.Update.meta())
|
|
76
|
+
tags: List[str] = field(default_factory=list)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass
|
|
80
|
+
class ColumnInfo(AdditionalPropertiesMixin, ExtensibleDbtClassMixin):
|
|
81
|
+
"""Used in all ManifestNodes and SourceDefinition"""
|
|
82
|
+
|
|
83
|
+
name: str
|
|
84
|
+
description: str = ""
|
|
85
|
+
meta: Dict[str, Any] = field(default_factory=dict)
|
|
86
|
+
data_type: Optional[str] = None
|
|
87
|
+
constraints: List[ColumnLevelConstraint] = field(default_factory=list)
|
|
88
|
+
quote: Optional[bool] = None
|
|
89
|
+
config: ColumnConfig = field(default_factory=ColumnConfig)
|
|
90
|
+
tags: List[str] = field(default_factory=list)
|
|
91
|
+
_extra: Dict[str, Any] = field(default_factory=dict)
|
|
92
|
+
granularity: Optional[TimeGranularity] = None
|
|
93
|
+
doc_blocks: List[str] = field(default_factory=list)
|
|
94
|
+
|
|
95
|
+
def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None) -> dict:
|
|
96
|
+
dct = super().__post_serialize__(dct, context)
|
|
97
|
+
dct["doc_blocks"] = _backcompat_doc_blocks(dct["doc_blocks"])
|
|
98
|
+
return dct
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
@dataclass
|
|
102
|
+
class InjectedCTE(dbtClassMixin):
|
|
103
|
+
"""Used in CompiledNodes as part of ephemeral model processing"""
|
|
104
|
+
|
|
105
|
+
id: str
|
|
106
|
+
sql: str
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass
|
|
110
|
+
class Contract(dbtClassMixin):
|
|
111
|
+
enforced: bool = False
|
|
112
|
+
alias_types: bool = True
|
|
113
|
+
checksum: Optional[str] = None
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
@dataclass
|
|
117
|
+
class Quoting(dbtClassMixin, Mergeable):
|
|
118
|
+
database: Optional[bool] = None
|
|
119
|
+
schema: Optional[bool] = None
|
|
120
|
+
identifier: Optional[bool] = None
|
|
121
|
+
column: Optional[bool] = None
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@dataclass
|
|
125
|
+
class Time(dbtClassMixin, Mergeable):
|
|
126
|
+
count: Optional[int] = None
|
|
127
|
+
period: Optional[TimePeriod] = None
|
|
128
|
+
|
|
129
|
+
def exceeded(self, actual_age: float) -> bool:
|
|
130
|
+
if self.period is None or self.count is None:
|
|
131
|
+
return False
|
|
132
|
+
kwargs: Dict[str, int] = {self.period.plural(): self.count}
|
|
133
|
+
difference = timedelta(**kwargs).total_seconds()
|
|
134
|
+
return actual_age > difference
|
|
135
|
+
|
|
136
|
+
def __bool__(self):
|
|
137
|
+
return self.count is not None and self.period is not None
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
@dataclass
|
|
141
|
+
class FreshnessThreshold(dbtClassMixin, Mergeable):
|
|
142
|
+
warn_after: Optional[Time] = field(default_factory=Time)
|
|
143
|
+
error_after: Optional[Time] = field(default_factory=Time)
|
|
144
|
+
filter: Optional[str] = None
|
|
145
|
+
|
|
146
|
+
def status(self, age: float) -> "dbt.artifacts.schemas.results.FreshnessStatus": # type: ignore # noqa F821
|
|
147
|
+
from dbt.artifacts.schemas.results import FreshnessStatus
|
|
148
|
+
|
|
149
|
+
if self.error_after and self.error_after.exceeded(age):
|
|
150
|
+
return FreshnessStatus.Error
|
|
151
|
+
elif self.warn_after and self.warn_after.exceeded(age):
|
|
152
|
+
return FreshnessStatus.Warn
|
|
153
|
+
else:
|
|
154
|
+
return FreshnessStatus.Pass
|
|
155
|
+
|
|
156
|
+
def __bool__(self):
|
|
157
|
+
return bool(self.warn_after) or bool(self.error_after)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@dataclass
|
|
161
|
+
class HasRelationMetadata(dbtClassMixin):
|
|
162
|
+
database: Optional[str]
|
|
163
|
+
schema: str
|
|
164
|
+
|
|
165
|
+
# Can't set database to None like it ought to be
|
|
166
|
+
# because it messes up the subclasses and default parameters
|
|
167
|
+
# so hack it here
|
|
168
|
+
@classmethod
|
|
169
|
+
def __pre_deserialize__(cls, data):
|
|
170
|
+
data = super().__pre_deserialize__(data)
|
|
171
|
+
if "database" not in data:
|
|
172
|
+
data["database"] = None
|
|
173
|
+
return data
|
|
174
|
+
|
|
175
|
+
@property
|
|
176
|
+
def quoting_dict(self) -> Dict[str, bool]:
|
|
177
|
+
if hasattr(self, "quoting"):
|
|
178
|
+
return self.quoting.to_dict(omit_none=True)
|
|
179
|
+
else:
|
|
180
|
+
return {}
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@dataclass
|
|
184
|
+
class DeferRelation(HasRelationMetadata):
|
|
185
|
+
alias: str
|
|
186
|
+
relation_name: Optional[str]
|
|
187
|
+
# The rest of these fields match RelationConfig protocol exactly
|
|
188
|
+
resource_type: NodeType
|
|
189
|
+
name: str
|
|
190
|
+
description: str
|
|
191
|
+
compiled_code: Optional[str]
|
|
192
|
+
meta: Dict[str, Any]
|
|
193
|
+
tags: List[str]
|
|
194
|
+
config: Optional[NodeConfig]
|
|
195
|
+
|
|
196
|
+
@property
|
|
197
|
+
def identifier(self):
|
|
198
|
+
return self.alias
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
@dataclass
|
|
202
|
+
class ParsedResourceMandatory(GraphResource, HasRelationMetadata):
|
|
203
|
+
alias: str
|
|
204
|
+
checksum: FileHash
|
|
205
|
+
config: NodeConfig = field(default_factory=NodeConfig)
|
|
206
|
+
|
|
207
|
+
@property
|
|
208
|
+
def identifier(self):
|
|
209
|
+
return self.alias
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@dataclass
|
|
213
|
+
class ParsedResource(ParsedResourceMandatory):
|
|
214
|
+
tags: List[str] = field(default_factory=list)
|
|
215
|
+
description: str = field(default="")
|
|
216
|
+
columns: Dict[str, ColumnInfo] = field(default_factory=dict)
|
|
217
|
+
meta: Dict[str, Any] = field(default_factory=dict)
|
|
218
|
+
group: Optional[str] = None
|
|
219
|
+
docs: Docs = field(default_factory=Docs)
|
|
220
|
+
patch_path: Optional[str] = None
|
|
221
|
+
build_path: Optional[str] = None
|
|
222
|
+
unrendered_config: Dict[str, Any] = field(default_factory=dict)
|
|
223
|
+
created_at: float = field(default_factory=lambda: time.time())
|
|
224
|
+
config_call_dict: Dict[str, Any] = field(default_factory=dict)
|
|
225
|
+
unrendered_config_call_dict: Dict[str, Any] = field(default_factory=dict)
|
|
226
|
+
relation_name: Optional[str] = None
|
|
227
|
+
raw_code: str = ""
|
|
228
|
+
doc_blocks: List[str] = field(default_factory=list)
|
|
229
|
+
|
|
230
|
+
def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None):
|
|
231
|
+
dct = super().__post_serialize__(dct, context)
|
|
232
|
+
|
|
233
|
+
if context and context.get("artifact") and "config_call_dict" in dct:
|
|
234
|
+
del dct["config_call_dict"]
|
|
235
|
+
if context and context.get("artifact") and "unrendered_config_call_dict" in dct:
|
|
236
|
+
del dct["unrendered_config_call_dict"]
|
|
237
|
+
|
|
238
|
+
dct["doc_blocks"] = _backcompat_doc_blocks(dct["doc_blocks"])
|
|
239
|
+
|
|
240
|
+
return dct
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
@dataclass
|
|
244
|
+
class CompiledResource(ParsedResource):
|
|
245
|
+
"""Contains attributes necessary for SQL files and nodes with refs, sources, etc,
|
|
246
|
+
so all ManifestNodes except SeedNode."""
|
|
247
|
+
|
|
248
|
+
language: str = "sql"
|
|
249
|
+
refs: List[RefArgs] = field(default_factory=list)
|
|
250
|
+
sources: List[List[str]] = field(default_factory=list)
|
|
251
|
+
metrics: List[List[str]] = field(default_factory=list)
|
|
252
|
+
functions: List[List[str]] = field(default_factory=list)
|
|
253
|
+
depends_on: DependsOn = field(default_factory=DependsOn)
|
|
254
|
+
compiled_path: Optional[str] = None
|
|
255
|
+
compiled: bool = False
|
|
256
|
+
compiled_code: Optional[str] = None
|
|
257
|
+
extra_ctes_injected: bool = False
|
|
258
|
+
extra_ctes: List[InjectedCTE] = field(default_factory=list)
|
|
259
|
+
_pre_injected_sql: Optional[str] = None
|
|
260
|
+
contract: Contract = field(default_factory=Contract)
|
|
261
|
+
|
|
262
|
+
def __post_serialize__(self, dct: Dict, context: Optional[Dict] = None):
|
|
263
|
+
dct = super().__post_serialize__(dct, context)
|
|
264
|
+
if "_pre_injected_sql" in dct:
|
|
265
|
+
del dct["_pre_injected_sql"]
|
|
266
|
+
# Remove compiled attributes
|
|
267
|
+
if "compiled" in dct and dct["compiled"] is False:
|
|
268
|
+
del dct["compiled"]
|
|
269
|
+
del dct["extra_ctes_injected"]
|
|
270
|
+
del dct["extra_ctes"]
|
|
271
|
+
# "omit_none" means these might not be in the dictionary
|
|
272
|
+
if "compiled_code" in dct:
|
|
273
|
+
del dct["compiled_code"]
|
|
274
|
+
return dct
|