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

[SNOW-151] Initialize dynamic table: accessrequirement_latest #84

Merged
merged 9 commits into from
Nov 21, 2024
Merged
Changes from 2 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
@@ -0,0 +1,22 @@
use schema {{database_name}}.synapse; --noqa: JJ01,PRS,TMP,CP01

CREATE DYNAMIC TABLE IF NOT EXISTS ACCESSREQUIREMENT_LATEST
TARGET_LAG = '1 day'
WAREHOUSE = compute_xsmall
AS
WITH latest_unique_rows AS (
SELECT
accessrequirementsnapshots.*,
FROM
{{database_name}}.synapse_raw.accessrequirementsnapshots --noqa: TMP
QUALIFY ROW_NUMBER() OVER (
PARTITION BY id
ORDER BY change_timestamp DESC, snapshot_timestamp DESC
) = 1
)
SELECT
*
FROM
latest_unique_rows
ORDER BY
latest_unique_rows.id ASC;