quollio-core 0.5.0__tar.gz → 0.5.3__tar.gz
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.
- {quollio_core-0.5.0 → quollio_core-0.5.3}/PKG-INFO +2 -2
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/__init__.py +1 -1
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_column_level.sql +17 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_table_level.sql +17 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_sqllineage_sources.sql +18 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_stats_profiling_columns.sql +18 -2
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/teradata/lineage.py +7 -3
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/teradata/stats.py +9 -3
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/teradata.py +19 -5
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/snowflake.py +36 -1
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/teradata.py +15 -1
- {quollio_core-0.5.0 → quollio_core-0.5.3}/LICENSE +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/README.md +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/pyproject.toml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/bigquery.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/bricks.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/.gitignore +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/README.md +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/analyses/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/dbt_project.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/macros/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/models/quollio_lineage_column_level.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/models/quollio_lineage_column_level.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/models/quollio_lineage_table_level.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/models/quollio_lineage_table_level.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/models/sources.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/packages_hub.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/packages_local.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/profiles/profiles_template.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/seeds/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/snapshots/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/README.md +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/analyses/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/dbt_project.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/macros/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/macros/materialization/divided_view.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_lineage_table_level.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_lineage_table_level.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_lineage_view_level.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_lineage_view_level.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_sqllineage_sources.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_sqllineage_sources.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_stats_columns.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_stats_columns.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_stats_profiling_columns.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/quollio_stats_profiling_columns.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/sources.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/packages_hub.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/packages_local.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/profiles/profiles_template.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/seeds/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/snapshots/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/seeds/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/README.md +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/analyses/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/dbt_project.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/macros/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/macros/materialization/divided_view.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_column_level.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_lineage_table_level.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_sqllineage_sources.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_stats_columns.sql +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_stats_columns.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/quollio_stats_profiling_columns.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/sources.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/packages_hub.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/packages_local.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/profiles/profiles_template.yml +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/seeds/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/snapshots/.gitkeep +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/helper/__init__.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/helper/core.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/helper/env_default.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/helper/log.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/helper/log_utils.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/__init__.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/bigquery.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/databricks.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/lineage.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/redshift.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/snowflake.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/sqllineage.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/profilers/stats.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/redshift.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/__init__.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/bigquery.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/databricks.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/dbt.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/qdc.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/redshift.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/snowflake.py +0 -0
- {quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/repository/ssm.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: quollio-core
|
3
|
-
Version: 0.5.
|
3
|
+
Version: 0.5.3
|
4
4
|
Summary: Quollio Core
|
5
5
|
Author-email: quollio-dev <qt.dev@quollio.com>
|
6
6
|
Maintainer-email: RyoAriyama <ryo.arym@gmail.com>, tharuta <35373297+TakumiHaruta@users.noreply.github.com>
|
@@ -95,6 +95,23 @@ UNION
|
|
95
95
|
{{ source('account_usage', 'TABLES') }}
|
96
96
|
WHERE
|
97
97
|
DELETED IS NULL
|
98
|
+
AND (
|
99
|
+
{% if var('target_databases_method') == 'ALLOWLIST' %}
|
100
|
+
{% if var('target_databases') %}
|
101
|
+
TABLE_CATALOG LIKE ANY ({{ var('target_databases')|join(",") }})
|
102
|
+
{% else %}
|
103
|
+
1=0 -- If no databases specified in allowlist, deny all
|
104
|
+
{% endif %}
|
105
|
+
{% elif var('target_databases_method') == 'DENYLIST' %}
|
106
|
+
{% if var('target_databases') %}
|
107
|
+
NOT (TABLE_CATALOG LIKE ANY ({{ var('target_databases')|join(",") }}))
|
108
|
+
{% else %}
|
109
|
+
1=1 -- If no databases specified in denylist, include all
|
110
|
+
{% endif %}
|
111
|
+
{% else %}
|
112
|
+
1=1 -- Default case: allow all databases
|
113
|
+
{% endif %}
|
114
|
+
)
|
98
115
|
), exists_upstream_column_lineage AS (
|
99
116
|
SELECT
|
100
117
|
downstream_table_name
|
@@ -49,6 +49,23 @@ WITH table_lineage_history AS (
|
|
49
49
|
{{ source('account_usage', 'TABLES') }}
|
50
50
|
WHERE
|
51
51
|
DELETED IS NULL
|
52
|
+
AND (
|
53
|
+
{% if var('target_databases_method') == 'ALLOWLIST' %}
|
54
|
+
{% if var('target_databases') %}
|
55
|
+
TABLE_CATALOG LIKE ANY ({{ var('target_databases')|join(",") }})
|
56
|
+
{% else %}
|
57
|
+
1=0 -- If no databases specified in allowlist, deny all
|
58
|
+
{% endif %}
|
59
|
+
{% elif var('target_databases_method') == 'DENYLIST' %}
|
60
|
+
{% if var('target_databases') %}
|
61
|
+
NOT (TABLE_CATALOG LIKE ANY ({{ var('target_databases')|join(",") }}))
|
62
|
+
{% else %}
|
63
|
+
1=1 -- If no databases specified in denylist, include all
|
64
|
+
{% endif %}
|
65
|
+
{% else %}
|
66
|
+
1=1 -- Default case: allow all databases
|
67
|
+
{% endif %}
|
68
|
+
)
|
52
69
|
), upstream_exists_table AS (
|
53
70
|
SELECT
|
54
71
|
downstream_table_name AS "DOWNSTREAM_TABLE_NAME"
|
@@ -48,3 +48,21 @@ on
|
|
48
48
|
lst.query_id = qt.query_id
|
49
49
|
where
|
50
50
|
qt.query_id is not null
|
51
|
+
AND (
|
52
|
+
{% if var('target_databases_method') == 'ALLOWLIST' %}
|
53
|
+
{% if var('target_databases') %}
|
54
|
+
database_name LIKE ANY ({{ var('target_databases')|join(",") }})
|
55
|
+
{% else %}
|
56
|
+
1=0 -- If no databases specified in allowlist, deny all
|
57
|
+
{% endif %}
|
58
|
+
{% elif var('target_databases_method') == 'DENYLIST' %}
|
59
|
+
{% if var('target_databases') %}
|
60
|
+
NOT (database_name LIKE ANY ({{ var('target_databases')|join(",") }}))
|
61
|
+
{% else %}
|
62
|
+
1=1 -- If no databases specified in denylist, include all
|
63
|
+
{% endif %}
|
64
|
+
{% else %}
|
65
|
+
1=1 -- Default case: allow all databases
|
66
|
+
{% endif %}
|
67
|
+
)
|
68
|
+
|
@@ -28,7 +28,7 @@ WITH columns AS (
|
|
28
28
|
FROM
|
29
29
|
{{ source('account_usage', 'GRANTS_TO_ROLES') }}
|
30
30
|
WHERE
|
31
|
-
granted_on in ('TABLE', 'MATERIALIZED VIEW')
|
31
|
+
granted_on in ('TABLE', 'VIEW', 'MATERIALIZED VIEW')
|
32
32
|
AND grantee_name = '{{ var("query_role") }}'
|
33
33
|
AND privilege in ('SELECT', 'OWNERSHIP')
|
34
34
|
AND deleted_on IS NULL
|
@@ -92,5 +92,21 @@ WITH columns AS (
|
|
92
92
|
else false END AS is_calculable
|
93
93
|
FROM
|
94
94
|
implicit_columns_removed
|
95
|
-
|
95
|
+
WHERE
|
96
|
+
{% if var('target_databases_method') == 'ALLOWLIST' %}
|
97
|
+
{% if var('target_databases') %}
|
98
|
+
TABLE_CATALOG LIKE ANY ({{ var('target_databases')|join(",") }})
|
99
|
+
{% else %}
|
100
|
+
1=0 -- If no databases specified in allowlist, deny all
|
101
|
+
{% endif %}
|
102
|
+
{% elif var('target_databases_method') == 'DENYLIST' %}
|
103
|
+
{% if var('target_databases') %}
|
104
|
+
NOT (TABLE_CATALOG LIKE ANY ({{ var('target_databases')|join(",") }}))
|
105
|
+
{% else %}
|
106
|
+
1=1 -- If no databases specified in denylist, include all
|
107
|
+
{% endif %}
|
108
|
+
{% else %}
|
109
|
+
1=1 -- Default case: allow all databases
|
110
|
+
{% endif %}
|
111
|
+
)
|
96
112
|
select * from final
|
@@ -17,11 +17,15 @@ def load_lineage(
|
|
17
17
|
tenant_id: str = None,
|
18
18
|
qdc_client: qdc.QDCExternalAPIClient = None,
|
19
19
|
page_size: int = None,
|
20
|
+
system_database: str = None,
|
20
21
|
) -> None:
|
21
22
|
page_size = page_size or int(os.environ.get("TERADATA_PAGE_SIZE", 1000))
|
22
23
|
offset = 0
|
23
24
|
all_lineage_results = []
|
24
25
|
|
26
|
+
# Use system_database from config if not provided
|
27
|
+
system_database = system_database or conn_config.system_database
|
28
|
+
|
25
29
|
with teradata_repo.new_teradata_client(conn_config) as conn:
|
26
30
|
while True:
|
27
31
|
query = f"""
|
@@ -30,10 +34,10 @@ def load_lineage(
|
|
30
34
|
TRIM(a.SqlTextInfo) AS SqlTextInfo,
|
31
35
|
a.SqlRowNo,
|
32
36
|
TRIM(d.DatabaseName) AS DefaultDatabase
|
33
|
-
FROM
|
34
|
-
JOIN
|
37
|
+
FROM {system_database}.QryLogSQLV a
|
38
|
+
JOIN {system_database}.QryLogV b
|
35
39
|
ON a.QueryID = b.QueryID
|
36
|
-
JOIN
|
40
|
+
JOIN {system_database}.DatabasesV d
|
37
41
|
ON b.DefaultDatabase = d.DatabaseName
|
38
42
|
WHERE
|
39
43
|
UPPER(TRIM(SqlTextInfo)) LIKE 'CREATE TABLE%'
|
@@ -27,6 +27,7 @@ def load_stats(
|
|
27
27
|
target_databases: Optional[List[str]] = None,
|
28
28
|
target_databases_method: str = "DENYLIST",
|
29
29
|
stats_items: Optional[List[str]] = None,
|
30
|
+
system_database: Optional[str] = None,
|
30
31
|
) -> None:
|
31
32
|
stats_list = []
|
32
33
|
numerical_columns = 0
|
@@ -35,16 +36,21 @@ def load_stats(
|
|
35
36
|
f"Starting statistics collection. " f"Sample percent: {sample_percent if sample_percent is not None else 'N/A'}"
|
36
37
|
)
|
37
38
|
|
39
|
+
# Use system_database from config if not provided
|
40
|
+
system_database = system_database or conn_config.system_database
|
41
|
+
|
38
42
|
with teradata_repo.new_teradata_client(conn_config) as conn:
|
39
43
|
try:
|
40
|
-
tables = teradata_repo.get_table_list(conn, target_databases, target_databases_method)
|
44
|
+
tables = teradata_repo.get_table_list(conn, target_databases, target_databases_method, system_database)
|
41
45
|
for table in tables:
|
42
46
|
logger.debug(f"Processing table: {table}")
|
43
|
-
database_name = table["
|
47
|
+
database_name = table["DatabaseName"]
|
44
48
|
table_name = table["TableName"]
|
45
49
|
|
46
50
|
logger.info(f"Processing table {database_name}.{table_name}")
|
47
|
-
columns = teradata_repo.get_column_list(
|
51
|
+
columns = teradata_repo.get_column_list(
|
52
|
+
conn, database_name=database_name, table_name=table_name, system_database=system_database
|
53
|
+
)
|
48
54
|
logger.debug(f"Columns: {columns}")
|
49
55
|
|
50
56
|
for column in columns:
|
@@ -13,18 +13,25 @@ class TeradataConfig:
|
|
13
13
|
username: str
|
14
14
|
password: str
|
15
15
|
database: str = "DBC"
|
16
|
+
system_database: str = "DBC"
|
16
17
|
encrypt_data: bool = True
|
17
18
|
additional_params: Dict[str, Any] = field(default_factory=dict)
|
18
19
|
|
19
20
|
@classmethod
|
20
21
|
def from_dict(
|
21
|
-
cls,
|
22
|
+
cls,
|
23
|
+
credentials: Dict[str, str],
|
24
|
+
host: str,
|
25
|
+
port: str,
|
26
|
+
additional_params: Dict[str, Any] = None,
|
27
|
+
system_database: str = "DBC",
|
22
28
|
) -> "TeradataConfig":
|
23
29
|
return cls(
|
24
30
|
host=host,
|
25
31
|
port=int(port),
|
26
32
|
username=credentials["username"],
|
27
33
|
password=credentials["password"],
|
34
|
+
system_database=system_database,
|
28
35
|
additional_params=additional_params or {},
|
29
36
|
)
|
30
37
|
|
@@ -49,7 +56,10 @@ def new_teradata_client(config: TeradataConfig) -> teradatasql.connect:
|
|
49
56
|
|
50
57
|
@error_handling_decorator
|
51
58
|
def get_table_list(
|
52
|
-
conn: teradatasql.connect,
|
59
|
+
conn: teradatasql.connect,
|
60
|
+
target_databases: Optional[List[str]] = None,
|
61
|
+
target_databases_method: str = "DENYLIST",
|
62
|
+
system_database: str = "DBC",
|
53
63
|
) -> List[Dict[str, str]]:
|
54
64
|
if target_databases_method == "DENYLIST":
|
55
65
|
operator = "NOT"
|
@@ -58,24 +68,28 @@ def get_table_list(
|
|
58
68
|
|
59
69
|
query_tables = f"""
|
60
70
|
SELECT DatabaseName, TableName
|
61
|
-
FROM
|
71
|
+
FROM {system_database}.TablesV
|
62
72
|
WHERE TableKind IN ('T', 'O', 'Q')
|
63
73
|
AND DatabaseName {operator} IN ({','.join("'" + db + "'" for db in target_databases)})
|
64
74
|
"""
|
65
75
|
logger.debug("Executing query to retrieve table names.")
|
76
|
+
logger.debug(f"Query: {query_tables}")
|
66
77
|
tables = execute_query(query_tables, conn)
|
67
78
|
return tables
|
68
79
|
|
69
80
|
|
70
81
|
@error_handling_decorator
|
71
|
-
def get_column_list(
|
82
|
+
def get_column_list(
|
83
|
+
conn: teradatasql.connect, database_name: str, table_name: str, system_database: str = "DBC"
|
84
|
+
) -> List[Dict[str, str]]:
|
72
85
|
query_columns = f"""
|
73
86
|
SELECT ColumnName, ColumnType
|
74
|
-
FROM
|
87
|
+
FROM {system_database}.ColumnsV
|
75
88
|
WHERE DatabaseName = '{database_name}'
|
76
89
|
AND TableName = '{table_name}'
|
77
90
|
"""
|
78
91
|
logger.debug(f"Executing query to retrieve columns for {database_name}.{table_name}.")
|
92
|
+
logger.debug(f"Query: {query_columns}")
|
79
93
|
columns = execute_query(query_columns, conn)
|
80
94
|
logger.debug(f"Retrieved columns: {columns}")
|
81
95
|
return columns
|
@@ -24,6 +24,8 @@ def build_view(
|
|
24
24
|
target_tables: str = "",
|
25
25
|
log_level: str = "info",
|
26
26
|
dbt_macro_source: str = "hub",
|
27
|
+
target_databases_method: str = "DENYLIST",
|
28
|
+
target_databases: list[str] = [],
|
27
29
|
) -> None:
|
28
30
|
logger.info("Build profiler views using dbt")
|
29
31
|
# set parameters
|
@@ -32,10 +34,16 @@ def build_view(
|
|
32
34
|
project_path = f"{current_dir}/dbt_projects/snowflake"
|
33
35
|
template_path = f"{current_dir}/dbt_projects/snowflake/profiles"
|
34
36
|
template_name = "profiles_template.yml"
|
35
|
-
|
37
|
+
|
38
|
+
options = '{{"query_role": "{query_role}", "sample_method": "{sample_method}",\
|
39
|
+
"target_databases_method": "{target_databases_method}",\
|
40
|
+
"target_databases": {target_databases}}}'.format(
|
36
41
|
query_role=conn.account_query_role,
|
37
42
|
sample_method=stats_sample_method,
|
43
|
+
target_databases_method=target_databases_method,
|
44
|
+
target_databases=target_databases,
|
38
45
|
)
|
46
|
+
|
39
47
|
new_package_file = f"{project_path}/packages.yml"
|
40
48
|
if dbt_macro_source == "local":
|
41
49
|
shutil.copyfile(f"{project_path}/packages_local.yml", new_package_file)
|
@@ -237,6 +245,25 @@ if __name__ == "__main__":
|
|
237
245
|
Please specify table name with blank delimiter like tableA tableB \
|
238
246
|
if you want to create two or more tables.",
|
239
247
|
)
|
248
|
+
parser.add_argument(
|
249
|
+
"--target_databases_method",
|
250
|
+
type=str,
|
251
|
+
choices=["ALLOWLIST", "DENYLIST"],
|
252
|
+
action=env_default("SNOWFLAKE_TARGET_DATABASE_METHOD"),
|
253
|
+
required=False,
|
254
|
+
help="Method to filter databases. 'ALLOWLIST' to only include listed databases,\
|
255
|
+
'DENNYLIST' to exclude listed databases",
|
256
|
+
)
|
257
|
+
parser.add_argument(
|
258
|
+
"--target_databases",
|
259
|
+
type=str,
|
260
|
+
nargs="*",
|
261
|
+
action=env_default("SNOWFLAKE_TARGET_DATABASES"),
|
262
|
+
required=False,
|
263
|
+
help='List of databases to allow or deny based on target_database_method\
|
264
|
+
please specify database names with blank space as delimiter\
|
265
|
+
wildcards (%) are supported "DATABASE%" ',
|
266
|
+
)
|
240
267
|
parser.add_argument(
|
241
268
|
"--sample_method",
|
242
269
|
type=str,
|
@@ -339,12 +366,20 @@ if __name__ == "__main__":
|
|
339
366
|
raise ValueError("No command is provided")
|
340
367
|
|
341
368
|
if "build_view" in args.commands:
|
369
|
+
|
370
|
+
if args.target_databases:
|
371
|
+
target_databases = ["'" + db + "'" for db in args.target_databases[0].split(",")]
|
372
|
+
else:
|
373
|
+
target_databases = []
|
374
|
+
|
342
375
|
build_view(
|
343
376
|
conn=conn,
|
344
377
|
stats_sample_method=args.sample_method,
|
345
378
|
target_tables=args.target_tables,
|
346
379
|
log_level=args.log_level,
|
347
380
|
dbt_macro_source=args.dbt_macro_source,
|
381
|
+
target_databases_method=args.target_databases_method,
|
382
|
+
target_databases=target_databases,
|
348
383
|
)
|
349
384
|
api_url = args.api_url
|
350
385
|
if args.external_api_access == "VPC_ENDPOINT":
|
@@ -189,6 +189,14 @@ def main() -> None:
|
|
189
189
|
You can choose the items to be aggregated for stats.\
|
190
190
|
Default is full stats.",
|
191
191
|
)
|
192
|
+
parser.add_argument(
|
193
|
+
"--teradata_system_database",
|
194
|
+
type=str,
|
195
|
+
action=env_default("TERADATA_SYSTEM_DATABASE"),
|
196
|
+
default="DBC",
|
197
|
+
help="Name of the Teradata system database.\
|
198
|
+
Default is DBC",
|
199
|
+
)
|
192
200
|
|
193
201
|
args = parser.parse_args()
|
194
202
|
|
@@ -213,7 +221,11 @@ def main() -> None:
|
|
213
221
|
|
214
222
|
logger.info("Initializing Teradata client")
|
215
223
|
config = teradata_repo.TeradataConfig.from_dict(
|
216
|
-
credentials,
|
224
|
+
credentials=credentials,
|
225
|
+
host=args.teradata_host,
|
226
|
+
port=args.teradata_port,
|
227
|
+
additional_params=additional_params,
|
228
|
+
system_database=args.teradata_system_database,
|
217
229
|
)
|
218
230
|
|
219
231
|
if "load_lineage" in args.commands:
|
@@ -224,6 +236,7 @@ def main() -> None:
|
|
224
236
|
endpoint=args.teradata_host,
|
225
237
|
qdc_client=qdc_client,
|
226
238
|
page_size=args.teradata_page_size,
|
239
|
+
system_database=args.teradata_system_database,
|
227
240
|
)
|
228
241
|
logger.info("Lineage loading process completed")
|
229
242
|
|
@@ -244,6 +257,7 @@ def main() -> None:
|
|
244
257
|
target_databases=target_databases,
|
245
258
|
target_databases_method=args.teradata_target_databases_method.upper(),
|
246
259
|
stats_items=args.target_stats_items,
|
260
|
+
system_database=args.teradata_system_database,
|
247
261
|
)
|
248
262
|
logger.info("Statistics loading process completed")
|
249
263
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/analyses/.gitkeep
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/dbt_project.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/macros/.gitkeep
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/models/sources.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/packages_hub.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/packages_local.yml
RENAMED
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/seeds/.gitkeep
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/databricks/snapshots/.gitkeep
RENAMED
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/analyses/.gitkeep
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/dbt_project.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/macros/.gitkeep
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/models/sources.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/packages_hub.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/packages_local.yml
RENAMED
File without changes
|
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/redshift/snapshots/.gitkeep
RENAMED
File without changes
|
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/analyses/.gitkeep
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/dbt_project.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/macros/.gitkeep
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/models/sources.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/packages_hub.yml
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/packages_local.yml
RENAMED
File without changes
|
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/seeds/.gitkeep
RENAMED
File without changes
|
{quollio_core-0.5.0 → quollio_core-0.5.3}/quollio_core/dbt_projects/snowflake/snapshots/.gitkeep
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|