Conversation
…g, data products)
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a Snowflake translation of all 12 Teradata tables under a new
ddl/snowflake/directory. The Teradata scripts (ddl/00_source_tables.sql,ddl/01_staging_tables.sql,ddl/02_data_product_tables.sql) are left untouched as the migration reference; nothing else in the repo is modified.Layout: Teradata databases become schemas inside one database per environment, with
<ENV>supplied as a SnowSQL variable (snowsql -f ... -D env=DEV):Every statement is
CREATE ... IF NOT EXISTS, so the scripts are idempotent and re-runnable in DEV/UAT/PROD without dropping data (CREATE OR REPLACEwas deliberately avoided on tables that hold operational/certified data).Construct mapping (full tables in
ddl/snowflake/README.md):MULTISET,NO FALLBACK,PRIMARY INDEX,COLLECT STATISTICS,CHARACTER SET LATIN NOT CASESPECIFIC,FORMAT 'YYYY-MM-DD'UNIQUE PRIMARY INDEX (TRANSACTION_TYPE_CD)PRIMARY KEYconstraint, to keep the uniqueness contract in the cataloguePARTITION BY RANGE_N(TRANSACTION_DATE ... EACH INTERVAL '1' MONTH)CLUSTER BY (TRANSACTION_DATE)onTRANSACTIONSPARTITION BY COLUMN(REPORTING_PERIOD)CLUSTER BY (REPORTING_PERIOD)onTRANSACTION_ANALYTICSTIMESTAMP(6)/DECIMAL(p,s)/CHAR(n)/DATETIMESTAMP_NTZ(6)/NUMBER(p,s)/VARCHAR(n)/DATEBIGINT/INTEGER/SMALLINTNUMBER(19,0)/NUMBER(10,0)/NUMBER(5,0)(preserves Teradata integer ranges rather than defaulting toNUMBER(38,0))No other table gets a clustering key: without a range/period access pattern, automatic micro-partitioning is sufficient and reclustering has ongoing cost.
Validation
sqlglotin thesnowflakedialect (after resolving the&{env}substitution).MULTISET,NO FALLBACK,PRIMARY INDEX,COLLECT STATISTICS,CASESPECIFICorRANGE_Nin executable SQL (they appear only in explanatory comments describing what was replaced).Assumptions
ETL_STAGING_DB.ETL_RUN_LOG(referenced by the BTEQ scripts) has no Teradata DDL in the affected files, so it is out of scope for this ticket and left to the ETL migration ticket.ILIKE/UPPER()), sinceNOT CASESPECIFICsemantics do not carry over.Devin-Org: engineering
Link to Devin session: https://app.devin.ai/sessions/cc38310e2ae84f23a9d0b38a2a858aba
Requested by: @hrabbani
Devin Review