Skip to content

Commit 2f82ebf

Browse files
authored
Merge pull request #18 from Sage-Bionetworks/SNOW-53-unhash-filenames
[SNOW-53, SNOW-37] reprocess nodeshapshot and update nodesnapshot task
2 parents 5bc6c27 + 845538d commit 2f82ebf

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP
2+
USE WAREHOUSE COMPUTE_MEDIUM;
3+
TRUNCATE TABLE NODESNAPSHOTS;
4+
ALTER TABLE NODESNAPSHOTS ADD COLUMN effective_ars VARIANT;
5+
copy into
6+
NODESNAPSHOTS
7+
from (
8+
select
9+
$1:change_type as change_type,
10+
$1:change_timestamp as change_timestamp,
11+
$1:change_user_id as change_user_id,
12+
$1:snapshot_timestamp as snapshot_timestamp,
13+
$1:id as id,
14+
$1:benefactor_id as benefactor_id,
15+
$1:project_id as project_id,
16+
$1:parent_id as parent_id,
17+
$1:node_type as node_type,
18+
$1:created_on as created_on,
19+
$1:created_by as created_by,
20+
$1:modified_on as modified_on,
21+
$1:modified_by as modified_by,
22+
$1:version_number as version_number,
23+
$1:file_handle_id as file_handle_id,
24+
$1:name as name,
25+
$1:is_public as is_public,
26+
$1:is_controlled as is_controlled,
27+
$1:is_restricted as is_restricted,
28+
NULLIF(
29+
regexp_replace (
30+
METADATA$FILENAME,
31+
'.*nodesnapshots\/snapshot_date\=(.*)\/.*',
32+
'\\1'),
33+
'__HIVE_DEFAULT_PARTITION__'
34+
) as snapshot_date,
35+
$1:effective_ars as effective_ars
36+
from @{{stage_storage_integration}}_stage/nodesnapshots/) --noqa: TMP
37+
pattern='.*nodesnapshots/snapshot_date=.*/.*'
38+
FORCE=TRUE
39+
;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
use role accountadmin;
2+
use schema {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP
3+
alter task refresh_synapse_warehouse_s3_stage_task suspend;
4+
alter task NODESNAPSHOT_TASK suspend;
5+
alter task UPSERT_TO_NODE_LATEST_TASK suspend;
6+
alter task REMOVE_DELETE_NODES_TASK suspend;
7+
alter task NODESNAPSHOT_TASK MODIFY AS
8+
copy into
9+
nodesnapshots
10+
from (
11+
select
12+
$1:change_type as change_type,
13+
$1:change_timestamp as change_timestamp,
14+
$1:change_user_id as change_user_id,
15+
$1:snapshot_timestamp as snapshot_timestamp,
16+
$1:id as id,
17+
$1:benefactor_id as benefactor_id,
18+
$1:project_id as project_id,
19+
$1:parent_id as parent_id,
20+
$1:node_type as node_type,
21+
$1:created_on as created_on,
22+
$1:created_by as created_by,
23+
$1:modified_on as modified_on,
24+
$1:modified_by as modified_by,
25+
$1:version_number as version_number,
26+
$1:file_handle_id as file_handle_id,
27+
$1:name as name,
28+
$1:is_public as is_public,
29+
$1:is_controlled as is_controlled,
30+
$1:is_restricted as is_restricted,
31+
NULLIF(
32+
REGEXP_REPLACE(
33+
metadata$filename,
34+
'.*nodesnapshots\/snapshot_date\=(.*)\/.*', '\\1'
35+
),
36+
'__HIVE_DEFAULT_PARTITION__'
37+
) as snapshot_date,
38+
$1:effective_ars as effective_ars
39+
from @{{stage_storage_integration}}_stage/nodesnapshots/ --noqa: TMP
40+
)
41+
pattern = '.*nodesnapshots/snapshot_date=.*/.*';
42+
43+
alter task REMOVE_DELETE_NODES_TASK resume;
44+
alter task UPSERT_TO_NODE_LATEST_TASK resume;
45+
alter task NODESNAPSHOT_TASK resume;
46+
alter task refresh_synapse_warehouse_s3_stage_task resume;

0 commit comments

Comments
 (0)