Skip to content

Commit 0742871

Browse files
authored
Merge pull request #25 from Sage-Bionetworks/add-snapshot-date
re-process fileinventory tables
2 parents 66f2869 + 7c35b8b commit 0742871

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
USE SCHEMA {{database_name}}.synapse_raw; --noqa: JJ01,PRS,TMP
2+
ALTER TABLE fileinventory ADD COLUMN snapshot_date DATE;
3+
ALTER TABLE fileinventory CLUSTER BY (snapshot_date)
4+
5+
USE WAREHOUSE COMPUTE_MEDIUM;
6+
TRUNCATE TABLE fileinventory;
7+
-- initial load of data
8+
copy into
9+
fileinventory
10+
from (
11+
select
12+
$1:bucket as bucket,
13+
$1:e_tag as e_tag,
14+
$1:encryption_status as encryption_status,
15+
$1:intelligent_tiering_access_tier as intelligent_tiering_access_tier,
16+
$1:is_delete_marker as is_delete_marker,
17+
$1:is_latest as is_latest,
18+
$1:is_multipart_uploaded as is_multipart_uploaded,
19+
$1:key as key,
20+
$1:last_modified_date as last_modified_date,
21+
$1:object_owner as object_owner,
22+
$1:size as size,
23+
$1:storage_class as storage_class,
24+
metadata$file_last_modified as snapshot_date
25+
from
26+
@{{stage_storage_integration}}_stage/inventory --noqa: TMP
27+
)
28+
pattern='.*defaultInventory/data/.*'
29+
;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 append_to_fileinventory_task suspend;
5+
6+
create task if not exists append_to_fileinventory_task
7+
user_task_managed_initial_warehouse_size = 'SMALL'
8+
AFTER refresh_synapse_warehouse_s3_stage_task
9+
as
10+
copy into
11+
fileinventory
12+
from (
13+
select
14+
$1:bucket as bucket,
15+
$1:e_tag as e_tag,
16+
$1:encryption_status as encryption_status,
17+
$1:intelligent_tiering_access_tier as intelligent_tiering_access_tier,
18+
$1:is_delete_marker as is_delete_marker,
19+
$1:is_latest as is_latest,
20+
$1:is_multipart_uploaded as is_multipart_uploaded,
21+
$1:key as key,
22+
$1:last_modified_date as last_modified_date,
23+
$1:object_owner as object_owner,
24+
$1:size as size,
25+
$1:storage_class as storage_class,
26+
metadata$file_last_modified as snapshot_date
27+
from
28+
@{{stage_storage_integration}}_stage/inventory --noqa: TMP
29+
)
30+
pattern='.*defaultInventory/data/.*';
31+
32+
alter task append_to_fileinventory_task resume;
33+
alter task refresh_synapse_warehouse_s3_stage_task resume;

0 commit comments

Comments
 (0)