Skip to content

Commit

Permalink
feat(deploy/migrations): fix 025 migration order and add dbt model me…
Browse files Browse the repository at this point in the history
…tadata
  • Loading branch information
Savid committed Jan 25, 2024
1 parent 2782777 commit c9c35c2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
ALTER TABLE default.beacon_api_eth_v1_events_attestation_local ON CLUSTER '{cluster}'
DROP COLUMN signature;

ALTER TABLE default.beacon_api_eth_v1_events_attestation ON CLUSTER '{cluster}'
DROP COLUMN signature;


ALTER TABLE default.beacon_p2p_attestation_local ON CLUSTER '{cluster}'
ALTER TABLE default.beacon_api_eth_v1_events_attestation_local ON CLUSTER '{cluster}'
DROP COLUMN signature;

ALTER TABLE default.beacon_p2p_attestation ON CLUSTER '{cluster}'
DROP COLUMN signature;

ALTER TABLE default.beacon_p2p_attestation_local ON CLUSTER '{cluster}'
DROP COLUMN signature;
2 changes: 2 additions & 0 deletions deploy/migrations/clickhouse/026_dbt_model_metadata.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP TABLE IF EXISTS model_metadata on cluster '{cluster}' SYNC;
DROP TABLE IF EXISTS model_metadata_local on cluster '{cluster}' SYNC;
17 changes: 17 additions & 0 deletions deploy/migrations/clickhouse/026_dbt_model_metadata.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
CREATE TABLE dbt.model_metadata_local on cluster '{cluster}'
(
model LowCardinality(String),
updated_date_time DateTime Codec(ZSTD(1)),
last_run_date_time DateTime Codec(ZSTD(1))
) Engine = ReplicatedReplacingMergeTree('/clickhouse/{installation}/{cluster}/tables/{shard}/{database}/{table}', '{replica}', updated_date_time)
PARTITION BY model
ORDER BY (model);

ALTER TABLE dbt.model_metadata_local ON CLUSTER '{cluster}'
MODIFY COMMENT 'Stores metadata about the dbt model run',
COMMENT COLUMN model 'Source of the data that was imported',
COMMENT COLUMN updated_date_time 'When this row was last updated',
COMMENT COLUMN last_run_date_time 'The end date the model was last run with';

CREATE TABLE dbt.model_metadata on cluster '{cluster}' AS dbt.model_metadata_local
ENGINE = Distributed('{cluster}', dbt, model_metadata_local, cityHash64(model));

0 comments on commit c9c35c2

Please sign in to comment.