-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(frontend): fix changelog out_col_change error and add snowflake u…
…psert sink demo (#17515)
- Loading branch information
Showing
8 changed files
with
108 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
-- please note that the column name(s) for your mv should be *exactly* | ||
-- the same as the column name(s) in your snowflake table, since we are matching column by name. | ||
|
||
CREATE MATERIALIZED VIEW ss_mv AS | ||
WITH sub AS changelog FROM user_behaviors | ||
SELECT | ||
user_id, | ||
target_id, | ||
event_timestamp AT TIME ZONE 'America/Indiana/Indianapolis' as event_timestamp, | ||
changelog_op AS __op, | ||
_changelog_row_id::bigint AS __row_id | ||
FROM | ||
sub; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE SINK snowflake_sink FROM ss_mv WITH ( | ||
connector = 'snowflake', | ||
type = 'append-only', | ||
snowflake.database = 'EXAMPLE_DB', | ||
snowflake.schema = 'EXAMPLE_SCHEMA', | ||
snowflake.pipe = 'EXAMPLE_SNOWFLAKE_PIPE', | ||
snowflake.account_identifier = '<ORG_NAME>-<ACCOUNT_NAME>', | ||
snowflake.user = 'XZHSEH', | ||
snowflake.rsa_public_key_fp = 'EXAMPLE_FP', | ||
snowflake.private_key = 'EXAMPLE_PK', | ||
snowflake.s3_bucket = 'EXAMPLE_S3_BUCKET', | ||
snowflake.aws_access_key_id = 'EXAMPLE_AWS_ID', | ||
snowflake.aws_secret_access_key = 'EXAMPLE_SECRET_KEY', | ||
snowflake.aws_region = 'EXAMPLE_REGION', | ||
snowflake.s3_path = 'EXAMPLE_S3_PATH', | ||
-- depends on your mv setup, note that snowflake sink *only* supports | ||
-- `append-only` mode at present. | ||
force_append_only = 'true' | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
-- please note that this will create a source that generates 1,000 rows in 10 seconds | ||
-- you may want to change the configuration for better testing / demo purpose | ||
|
||
CREATE table user_behaviors ( | ||
user_id int, | ||
target_id VARCHAR, | ||
target_type VARCHAR, | ||
event_timestamp TIMESTAMPTZ, | ||
behavior_type VARCHAR, | ||
parent_target_type VARCHAR, | ||
parent_target_id VARCHAR, | ||
PRIMARY KEY(user_id) | ||
) WITH ( | ||
connector = 'datagen', | ||
fields.user_id.kind = 'sequence', | ||
fields.user_id.start = '1', | ||
fields.user_id.end = '1000', | ||
datagen.rows.per.second = '100' | ||
) FORMAT PLAIN ENCODE JSON; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters