Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest/snowflake): fix error case in column lineage #10808

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,7 @@ def table_upstreams_with_column_lineage(
t.query_start_time AS query_start_time,
t.query_id AS query_id
FROM
(
SELECT * from snowflake.account_usage.access_history
WHERE
query_start_time >= to_timestamp_ltz({start_time_millis}, 3)
AND query_start_time < to_timestamp_ltz({end_time_millis}, 3)
) t,
snowflake.account_usage.access_history t,
lateral flatten(input => t.DIRECT_OBJECTS_ACCESSED) r,
lateral flatten(input => t.OBJECTS_MODIFIED) w,
lateral flatten(input => w.value : "columns", outer => true) wcols,
Expand Down Expand Up @@ -780,12 +775,14 @@ def table_upstreams_with_column_lineage(
queries AS (
select qid.downstream_table_name, qid.query_id, query_history.query_text, query_history.start_time
from query_ids qid
JOIN (
LEFT JOIN (
SELECT * FROM snowflake.account_usage.query_history
WHERE query_history.start_time >= to_timestamp_ltz({start_time_millis}, 3)
AND query_history.start_time < to_timestamp_ltz({end_time_millis}, 3)
) query_history
on qid.query_id = query_history.query_id
WHERE qid.query_id is not null
AND query_history.query_text is not null
)
SELECT
h.downstream_table_name AS "DOWNSTREAM_TABLE_NAME",
Expand Down Expand Up @@ -850,12 +847,7 @@ def table_upstreams_only(
t.query_start_time AS query_start_time,
t.query_id AS query_id
FROM
(
SELECT * from snowflake.account_usage.access_history
WHERE
query_start_time >= to_timestamp_ltz({start_time_millis}, 3)
AND query_start_time < to_timestamp_ltz({end_time_millis}, 3)
) t,
snowflake.account_usage.access_history t,
lateral flatten(input => t.DIRECT_OBJECTS_ACCESSED) r,
lateral flatten(input => t.OBJECTS_MODIFIED) w
WHERE
Expand Down
Loading