Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit de2b7c9

Browse files
committed
simplify
1 parent f23acb5 commit de2b7c9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

data_diff/dbt.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ def dbt_diff(
6060
config_prod_database = datadiff_variables.get("prod_database")
6161
config_prod_schema = datadiff_variables.get("prod_schema")
6262
datasource_id = datadiff_variables.get("datasource_id")
63-
disable_custom_schemas = datadiff_variables.get("disable_custom_schemas")
63+
custom_schemas = datadiff_variables.get("custom_schemas")
64+
# custom schemas is default dbt behavior, so default to True if the var doesn't exist
65+
custom_schemas = True if custom_schemas is None else custom_schemas
6466

6567
if not is_cloud:
6668
dbt_parser.set_connection()
@@ -72,7 +74,7 @@ def dbt_diff(
7274

7375
for model in models:
7476
diff_vars = _get_diff_vars(
75-
dbt_parser, config_prod_database, config_prod_schema, model, datasource_id, disable_custom_schemas
77+
dbt_parser, config_prod_database, config_prod_schema, model, datasource_id, custom_schemas
7678
)
7779

7880
if is_cloud and len(diff_vars.primary_keys) > 0:
@@ -98,7 +100,7 @@ def _get_diff_vars(
98100
config_prod_schema: Optional[str],
99101
model,
100102
datasource_id: int,
101-
disable_custom_schemas: Optional[bool],
103+
custom_schemas: bool,
102104
) -> DiffVars:
103105
dev_database = model.database
104106
dev_schema = model.schema_
@@ -107,10 +109,10 @@ def _get_diff_vars(
107109
prod_database = config_prod_database if config_prod_database else dev_database
108110
prod_schema = config_prod_schema if config_prod_schema else dev_schema
109111

110-
# if project has not disabled custom schemas
112+
# if project has custom schemas (default)
111113
# need to construct the prod schema as <prod_target_schema>_<custom_schema>
112114
# https://docs.getdbt.com/docs/build/custom-schemas
113-
if not disable_custom_schemas and model.config.schema_:
115+
if custom_schemas and model.config.schema_:
114116
prod_schema = prod_schema + "_" + model.config.schema_
115117

116118
if dbt_parser.requires_upper:

0 commit comments

Comments
 (0)