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-53, SNOW-37] reprocess nodeshapshot and update nodesnapshot task #18

Merged
merged 2 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
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
@@ -0,0 +1,39 @@
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP
USE WAREHOUSE COMPUTE_MEDIUM;
TRUNCATE TABLE NODESNAPSHOTS;
ALTER TABLE NODESNAPSHOTS ADD COLUMN effective_ars VARIANT;
copy into
NODESNAPSHOTS
from (
select
$1:change_type as change_type,
$1:change_timestamp as change_timestamp,
$1:change_user_id as change_user_id,
$1:snapshot_timestamp as snapshot_timestamp,
$1:id as id,
$1:benefactor_id as benefactor_id,
$1:project_id as project_id,
$1:parent_id as parent_id,
$1:node_type as node_type,
$1:created_on as created_on,
$1:created_by as created_by,
$1:modified_on as modified_on,
$1:modified_by as modified_by,
$1:version_number as version_number,
$1:file_handle_id as file_handle_id,
$1:name as name,
$1:is_public as is_public,
$1:is_controlled as is_controlled,
$1:is_restricted as is_restricted,
NULLIF(
regexp_replace (
METADATA$FILENAME,
'.*nodesnapshots\/snapshot_date\=(.*)\/.*',
'\\1'),
'__HIVE_DEFAULT_PARTITION__'
) as snapshot_date,
$1:effective_ars as effective_ars
from @{{stage_storage_integration}}_stage/nodesnapshots/) --noqa: TMP
pattern='.*nodesnapshots/snapshot_date=.*/.*'
FORCE=TRUE
;
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use role accountadmin;
use schema {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP
alter task refresh_synapse_warehouse_s3_stage_task suspend;
alter task NODESNAPSHOT_TASK suspend;
alter task UPSERT_TO_NODE_LATEST_TASK suspend;
alter task REMOVE_DELETE_NODES_TASK suspend;
alter task NODESNAPSHOT_TASK MODIFY AS
copy into
nodesnapshots
from (
select
$1:change_type as change_type,
$1:change_timestamp as change_timestamp,
$1:change_user_id as change_user_id,
$1:snapshot_timestamp as snapshot_timestamp,
$1:id as id,
$1:benefactor_id as benefactor_id,
$1:project_id as project_id,
$1:parent_id as parent_id,
$1:node_type as node_type,
$1:created_on as created_on,
$1:created_by as created_by,
$1:modified_on as modified_on,
$1:modified_by as modified_by,
$1:version_number as version_number,
$1:file_handle_id as file_handle_id,
$1:name as name,
$1:is_public as is_public,
$1:is_controlled as is_controlled,
$1:is_restricted as is_restricted,
NULLIF(
REGEXP_REPLACE(
metadata$filename,
'.*nodesnapshots\/snapshot_date\=(.*)\/.*', '\\1'
),
'__HIVE_DEFAULT_PARTITION__'
) as snapshot_date,
$1:effective_ars as effective_ars
from @{{stage_storage_integration}}_stage/nodesnapshots/ --noqa: TMP
)
pattern = '.*nodesnapshots/snapshot_date=.*/.*';

alter task REMOVE_DELETE_NODES_TASK resume;
alter task UPSERT_TO_NODE_LATEST_TASK resume;
alter task NODESNAPSHOT_TASK resume;
alter task refresh_synapse_warehouse_s3_stage_task resume;