Skip to content

Commit 350cd60

Browse files
authored
Merge pull request #24 from Sage-Bionetworks/SNOW-54-alter-filesnapshot-tasks
Alter filesnapshot task and fix filedownload task
2 parents f979ac7 + e2e8e70 commit 350cd60

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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 filesnapshots_task suspend;
5+
alter task UPSERT_TO_FILE_LATEST_TASK suspend;
6+
alter task REMOVE_DELETE_FILES_TASK suspend;
7+
alter task filesnapshots_task MODIFY AS
8+
copy into filesnapshots from (
9+
select
10+
$1:change_type as change_type,
11+
$1:change_timestamp as change_timestamp,
12+
$1:change_user_id as change_user_id,
13+
$1:snapshot_timestamp as snapshot_timestamp,
14+
$1:id as id,
15+
$1:created_by as created_by,
16+
$1:created_on as created_on,
17+
$1:modified_on as modified_on,
18+
$1:concrete_type as concrete_type,
19+
$1:content_md5 as content_md5,
20+
$1:content_type as content_type,
21+
$1:file_name as file_name,
22+
$1:storage_location_id as storage_location_id,
23+
$1:content_size as content_size,
24+
$1:bucket as bucket,
25+
$1:key as key,
26+
$1:preview_id as preview_id,
27+
$1:is_preview as is_preview,
28+
$1:status as status,
29+
NULLIF(
30+
REGEXP_REPLACE(
31+
metadata$filename,
32+
'.*filesnapshots\/snapshot_date\=(.*)\/.*',
33+
'\\1'
34+
),
35+
'__HIVE_DEFAULT_PARTITION__'
36+
) as snapshot_date
37+
from
38+
@{{stage_storage_integration}}_stage/filesnapshots --noqa: TMP
39+
)
40+
pattern = '.*filesnapshots/snapshot_date=.*/.*';
41+
42+
alter task REMOVE_DELETE_FILES_TASK resume;
43+
alter task UPSERT_TO_FILE_LATEST_TASK resume;
44+
alter task filesnapshots_task resume;
45+
alter task refresh_synapse_warehouse_s3_stage_task resume;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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 FILEDOWNLOAD_TASK suspend;
5+
alter task CLONE_FILEDOWNLOAD_TASK suspend;
6+
alter task FILEDOWNLOAD_TASK MODIFY AS
7+
copy into
8+
filedownload
9+
from (
10+
select
11+
$1:timestamp as timestamp,
12+
$1:user_id as user_id,
13+
$1:project_id as project_id,
14+
$1:file_handle_id as file_handle_id,
15+
$1:downloaded_file_handle_id as downloaded_file_handle_id,
16+
$1:association_object_id as association_object_id,
17+
$1:association_object_type as association_object_type,
18+
$1:stack as stack,
19+
$1:instance as instance,
20+
NULLIF(
21+
REGEXP_REPLACE(
22+
metadata$filename,
23+
'.*filedownloadrecords\/record_date\=(.*)\/.*',
24+
'\\1'
25+
),
26+
'__HIVE_DEFAULT_PARTITION__'
27+
) as record_date,
28+
$1:session_id as session_id
29+
from
30+
@{{stage_storage_integration}}_stage/filedownloadrecords --noqa: TMP
31+
)
32+
pattern = '.*filedownloadrecords/record_date=.*/.*';
33+
34+
alter task CLONE_FILEDOWNLOAD_TASK resume;
35+
alter task FILEDOWNLOAD_TASK resume;
36+
alter task refresh_synapse_warehouse_s3_stage_task resume;

0 commit comments

Comments
 (0)