SnowConvert AI – Redshift – CREATE TABLE

Grammatikalische Syntax von CREATE TABLE

Beschreibung

Erzeugt eine neue Tabelle in der aktuellen Datenbank. Sie definieren eine Liste von Spalten, die jeweils Daten eines bestimmten Typs enthalten. Der Eigentümer der Tabelle ist derjenige, der den CREATE TABLE-Befehl erteilt hat.

Weitere Informationen finden Sie in der Dokumentation [CREATE TABLE](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW. html).

Grammatikalische Syntax

 CREATE [ [LOCAL ] { TEMPORARY | TEMP } ] TABLE
[ IF NOT EXISTS ] table_name
( { column_name data_type [column_attributes] [ column_constraints ]
  | table_constraints
  | LIKE parent_table [ { INCLUDING | EXCLUDING } DEFAULTS ] }
  [, ... ]  )
[ BACKUP { YES | NO } ]
[table_attributes]

where column_attributes are:
  [ DEFAULT default_expr ]
  [ IDENTITY ( seed, step ) ]
  [ GENERATED BY DEFAULT AS IDENTITY ( seed, step ) ]
  [ ENCODE encoding ]
  [ DISTKEY ]
  [ SORTKEY ]
  [ COLLATE CASE_SENSITIVE | COLLATE CASE_INSENSITIVE  ]

and column_constraints are:
  [ { NOT NULL | NULL } ]
  [ { UNIQUE  |  PRIMARY KEY } ]
  [ REFERENCES reftable [ ( refcolumn ) ] ]

and table_constraints  are:
  [ UNIQUE ( column_name [, ... ] ) ]
  [ PRIMARY KEY ( column_name [, ... ] )  ]
  [ FOREIGN KEY (column_name [, ... ] ) REFERENCES reftable [ ( refcolumn ) ]


and table_attributes are:
  [ DISTSTYLE { AUTO | EVEN | KEY | ALL } ]
  [ DISTKEY ( column_name ) ]
  [ [COMPOUND | INTERLEAVED ] SORTKEY ( column_name [,...]) |  [ SORTKEY AUTO ] ]
  [ ENCODE AUTO ]
         

BACKUP

Beschreibung

Ermöglicht Amazon Redshift die automatische Anpassung des Kodierungstyps für alle Spalten in der Tabelle, um die Abfrageleistung zu optimieren. In Snowflake ist das Konzept von BACKUP, wie es in anderen Datenbanken üblich ist, nicht direkt anwendbar. Snowflake übernimmt automatisch die Datensicherung und -wiederherstellung durch seine integrierten Features wie Time Travel und Fail-safe, so dass keine manuellen Sicherungs-Operationen mehr erforderlich sind. Aus diesen Gründen wird die Anweisung BACKUP während des Transformationsprozesses entfernt

See the Redshift data distribution documentation for this syntax.

Grammatikalische Syntax

 BACKUP { YES | NO }

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER
)
BACKUP YES;
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

IF NOT EXISTS

Beschreibung

In Amazon Redshift wird IF NOT EXISTS in Befehlen zur Tabellenerstellung verwendet, um Fehler zu vermeiden, wenn die Tabelle bereits existiert. Wenn Sie diese Option einschließen, wird die Tabelle nur dann erstellt, wenn sie noch nicht vorhanden ist. Dadurch werden Duplikate und Fehler in Ihrem SQL-Skript vermieden.

See the Redshift CREATE TABLE documentation for this syntax.

Grammatikalische Syntax

 IF NOT EXISTS

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE IF NOT EXISTS table1 (
    col1 INTEGER
);
Ausgabecode:
Snowflake
 CREATE TABLE IF NOT EXISTS table1 (
    col1 INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

Zugehörige EWIs

Es gibt keine bekannten Probleme.

LOCAL

Beschreibung

In Amazon Redshift werden LOCAL TEMPORARY oder TEMP verwendet, um temporäre Tabellen zu erstellen, die nur für die Dauer der Sitzung existieren. Diese Tabellen sind sitzungsspezifisch und werden automatisch gelöscht, wenn die Sitzung endet. Sie sind nützlich, um Zwischenergebnisse oder Arbeitsdaten zu speichern, ohne das permanente Datenbankschema zu beeinflussen.

See the Redshift CREATE TABLE documentation for this syntax.

Grammatikalische Syntax

 LOCAL { TEMPORARY | TEMP }

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE LOCAL TEMPORARY TABLE table1 (
    col1 INTEGER
);
Ausgabecode:
Snowflake
 CREATE LOCAL TEMPORARY TABLE table1 (
    col1 INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

Zugehörige EWIs

Es gibt keine bekannten Probleme.

DISTKEY

Beschreibung

In Amazon Redshift wird DISTKEY verwendet, um die Daten auf die Clusterknoten zu verteilen und so die Abfrageleistung zu optimieren. Snowflake hingegen kümmert sich automatisch um die Verteilung und Speicherung von Daten, ohne dass explizite Verteilungsschlüssel benötigt werden. Aufgrund der unterschiedlichen Architektur und Datenverwaltungsansätze hat Snowflake kein direktes Äquivalent zu DISTKEY von Redshift.

See the Redshift data distribution documentation for this syntax.

Grammatikalische Syntax

 DISTKEY ( column_name )

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER
)
DISTKEY (col1);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
----** SSC-FDM-RS0001 - DISTKEY OPTION IS NOT SUPPORTED IN SNOWFLAKE. DATA STORAGE IS AUTOMATICALLY HANDLED BY SNOWFLAKE. **
--DISTKEY (col1)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "03/03/2025",  "domain": "test" }}';

Zugehörige EWIs

  1. SSC-FDM-RS0001: Data storage option is not supported in Snowflake. Data distribution is automatically handled by Snowflake.

DISTSTYLE

Beschreibung

Schlüsselwort, das den Stil der Datenverteilung für die gesamte Tabelle definiert.

See the Redshift data distribution documentation for this syntax.

Grammatikalische Syntax

 DISTSTYLE { AUTO | EVEN | KEY | ALL }

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER
)
DISTSTYLE AUTO;

CREATE TABLE table2 (
    col1 INTEGER
)
DISTSTYLE EVEN;

CREATE TABLE table3 (
    col1 INTEGER
)
DISTSTYLE KEY
DISTKEY (col1);

CREATE TABLE table4 (
    col1 INTEGER
)
DISTSTYLE ALL;
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
----** SSC-FDM-RS0001 - DISTSTYLE AUTO OPTION IS NOT SUPPORTED IN SNOWFLAKE. DATA STORAGE IS AUTOMATICALLY HANDLED BY SNOWFLAKE. **
--DISTSTYLE AUTO
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

CREATE TABLE table2 (
    col1 INTEGER
)
----** SSC-FDM-RS0001 - DISTSTYLE EVEN OPTION IS NOT SUPPORTED IN SNOWFLAKE. DATA STORAGE IS AUTOMATICALLY HANDLED BY SNOWFLAKE. **
--DISTSTYLE EVEN
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

CREATE TABLE table3 (
    col1 INTEGER
)
----** SSC-FDM-RS0001 - DISTSTYLE KEY OPTION IS NOT SUPPORTED IN SNOWFLAKE. DATA STORAGE IS AUTOMATICALLY HANDLED BY SNOWFLAKE. **
--DISTSTYLE KEY
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

CREATE TABLE table4 (
    col1 INTEGER
)
----** SSC-FDM-RS0001 - DISTSTYLE ALL OPTION IS NOT SUPPORTED IN SNOWFLAKE. DATA STORAGE IS AUTOMATICALLY HANDLED BY SNOWFLAKE. **
--DISTSTYLE ALL
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

Zugehörige EWIs

  1. SSC-FDM-RS0001: Data storage option is not supported in Snowflake. Data distribution is automatically handled by Snowflake.

ENCODE

Beschreibung

In Snowflake ist es nicht notwendig, ENCODE zu definieren, da die Datenkomprimierung automatisch erfolgt, im Gegensatz zu Redshift, das manuelle Kodierungseinstellungen erfordert. Aus diesem Grund wird die Anweisung ENCODE während der Migration entfernt.

See the Redshift CREATE TABLE documentation for this syntax.

Grammatikalische Syntax

 ENCODE AUTO

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER
)
ENCODE AUTO;
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es sind keine Probleme bekannt.

SORTKEY

Beschreibung

Das Schlüsselwort, das angibt, dass die Spalte der Sortierschlüssel für die Tabelle ist. In Snowflake kann SORTKEY von Redshift auf CLUSTER BY migriert werden, da beide den Datenspeicher für die Abfrageleistung optimieren. CLUSTER BY in Snowflake organisiert die Daten nach bestimmten Spalten, ähnlich wie SORTKEY die Daten in Redshift ordnet.

See the Redshift data distribution documentation for this syntax.

Grammatikalische Syntax

 [COMPOUND | INTERLEAVED ] SORTKEY ( column_name [,...]) | [ SORTKEY AUTO ]

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER,
    col2 VARCHAR,
    col3 INTEGER,
    col4 INTEGER
)
COMPOUND SORTKEY (col1, col3);

CREATE TABLE table2 (
    col1 INTEGER
)
INTERLEAVED SORTKEY (col1);

CREATE TABLE table3 (
    col1 INTEGER
)
SORTKEY AUTO;
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER,
    col2 VARCHAR,
    col3 INTEGER,
    col4 INTEGER
)
--** SSC-FDM-RS0002 - THE PERFORMANCE OF CLUSTER BY IN SNOWFLAKE MAY VARY COMPARED TO THE PERFORMANCE OF SORTKEY IN REDSHIFT. **
CLUSTER BY (col1, col3)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

CREATE TABLE table2 (
    col1 INTEGER
)
--** SSC-FDM-RS0002 - THE PERFORMANCE OF CLUSTER BY IN SNOWFLAKE MAY VARY COMPARED TO THE PERFORMANCE OF SORTKEY IN REDSHIFT. **
CLUSTER BY (col1)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

CREATE TABLE table3 (
    col1 INTEGER
)
----** SSC-FDM-RS0001 - SORTKEY AUTO OPTION IS NOT SUPPORTED IN SNOWFLAKE. DATA STORAGE IS AUTOMATICALLY HANDLED BY SNOWFLAKE. **
--SORTKEY AUTO
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

Zugehörige EWIs

  1. SSC-FDM-RS0001: Data storage option is not supported in Snowflake. Data distribution is automatically handled by Snowflake.

  2. SSC-FDM-RS0002: The performance of CLUSTER BY in Snowflake may vary compared to the performance of SORTKEY in Redshift.

FOREIGN KEY

Beschreibung

Einschränkung, die eine Fremdschlüsseleinschränkung angibt, die verlangt, dass eine Gruppe von einer oder mehreren Spalten der neuen Tabelle nur Werte enthalten darf, die mit den Werten in der referenzierten Spalte oder den Spalten einer Zeile der referenzierten Tabelle übereinstimmen.

See the Redshift CREATE TABLE documentation for this syntax.

Warnung

Die Übersetzung für Foreign Key wird in Zukunft geliefert.

Grammatikalische Syntax

 FOREIGN KEY (column_name [, ... ] ) REFERENCES reftable [ ( refcolumn )

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table15 (
    col1 INTEGER,
    FOREIGN KEY (col1) REFERENCES table_test (col1)
);
Ausgabecode:
Snowflake
 CREATE TABLE table15 (
    col1 INTEGER
--                ,
--    --** SSC-FDM-RS0003 - SNOWCONVERT AI TRANSLATION FOR REDSHIFT FOREIGN KEY CONSTRAINTS IS PENDING. **
--    FOREIGN KEY (col1) REFERENCES table_test (col1)
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/26/2024" }}';

Zugehörige EWIs

  • [SSC-FDM-RSOOO3](../../general/technical-documentation/issues-and-troubleshooting/functional-difference/redshiftFDM. md#ssc-fdm-rs0003): Die Übersetzung von Foreign Key wird in Zukunft unterstützt.

PRIMARY KEY

Beschreibung

Legt fest, dass eine Spalte oder eine Anzahl von Spalten einer Tabelle nur eindeutige Nicht-Null-Werte enthalten darf

See the Redshift CREATE TABLE documentation for this syntax.

Bemerkung

In Snowflake werden eindeutige, Primär- und Fremdschlüssel zur Dokumentation verwendet und erzwingen keine Einschränkungen oder Eindeutigkeit. Sie helfen bei der Beschreibung von Tabellenbeziehungen, haben aber keinen Einfluss auf die Datenintegrität oder Leistung.

Grammatikalische Syntax

 PRIMARY KEY ( column_name [, ... ] )

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER, 
    col2 INTEGER,
    PRIMARY KEY (col1)
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER,
    col2 INTEGER,
    PRIMARY KEY (col1)
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

UNIQUE

Beschreibung

Legt fest, dass eine Gruppe von einer oder mehreren Spalten einer Tabelle nur eindeutige Werte enthalten darf.

See the Redshift CREATE TABLE documentation for this syntax.

Bemerkung

In Snowflake werden eindeutige, Primär- und Fremdschlüssel zur Dokumentation verwendet und erzwingen keine Einschränkungen oder Eindeutigkeit. Sie helfen bei der Beschreibung von Tabellenbeziehungen, haben aber keinen Einfluss auf die Datenintegrität oder Leistung.

Grammatikalische Syntax

 UNIQUE ( column_name [, ... ] )

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER, 
    col2 INTEGER,
    UNIQUE ( col1, col2 )
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER,
    col2 INTEGER,
    UNIQUE ( col1, col2 )
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

NOT NULL | NULL

Beschreibung

NOT NULL legt fest, dass die Spalte keine Nullwerte enthalten darf. NULL, die Voreinstellung, gibt an, dass die Spalte Nullwerte akzeptiert.

See the Redshift CREATE TABLE documentation for this syntax.

Grammatikalische Syntax

 NOT NULL | NULL

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER NOT NULL, 
    col2 INTEGER NULL
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER NOT NULL,
    col2 INTEGER NULL
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

REFERENCES

Beschreibung

Gibt eine Fremdschlüsseleinschränkung an, die besagt, dass die Spalte nur Werte enthalten darf, die mit Werten in der referenzierten Spalte einer Zeile der referenzierten Tabelle übereinstimmen

See the Redshift CREATE TABLE documentation for this syntax.

Grammatikalische Syntax

 REFERENCES reftable [ ( refcolumn ) ]

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER REFERENCES table_test (col1)
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER REFERENCES table_test (col1)
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

UNIQUE | PRIMARY KEY

Beschreibung

Legt fest, dass die Spalte nur eindeutige Werte enthalten darf. In Snowflake werden sowohl UNIQUE als auch PRIMARY KEY verwendet, um Daten zu dokumentieren und zu strukturieren. Sie verfügen jedoch nicht über aktive Datenvalidierungsfunktionen in dem Sinne, wie Sie es von anderen Datenbanksystemen erwarten würden, die diese Einschränkungen auf der Speicherebene erzwingen.

See the Redshift CREATE TABLE documentation for this syntax.

Bemerkung

In Snowflake werden eindeutige, Primär- und Fremdschlüssel zur Dokumentation verwendet und erzwingen keine Einschränkungen oder Eindeutigkeit. Sie helfen bei der Beschreibung von Tabellenbeziehungen, haben aber keinen Einfluss auf die Datenintegrität oder Leistung.

Grammatikalische Syntax

 UNIQUE | PRIMARY KEY

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER PRIMARY KEY,
    col2 INTEGER UNIQUE
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER PRIMARY KEY,
    col2 INTEGER UNIQUE
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

COLLATE

Beschreibung

Gibt an, ob die Zeichenfolgensuche oder der Vergleich in der Spalte CASE_SENSITIVE oder CASE_INSENSITIVE ist.

See the Redshift CREATE TABLE documentation for this syntax.

Bemerkung

Die Standard-Sortiersprache ist Englisch. Wenn Ihre Datenbank eine andere Sprache verwendet, aktualisieren Sie bitte das Präfix ‚en-‘, damit es der Sprache Ihrer Datenbank entspricht. Weitere Informationen finden Sie unter diesem Link.

Grammatikalische Syntax

 COLLATE CASE_SENSITIVE | COLLATE CASE_INSENSITIVE

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 TEXT COLLATE CASE_SENSITIVE,
    col2 TEXT COLLATE CASE_INSENSITIVE
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 TEXT COLLATE 'en-cs',
    col2 TEXT COLLATE 'en-ci'
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Bekannte Probleme

Es sind keine Probleme bekannt.

DEFAULT

Beschreibung

Weist einen Standarddatenwert für die Spalte zu.

See the Redshift CREATE TABLE DEFAULT clause documentation for this syntax.

Grammatikalische Syntax

 DEFAULT default_expr

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER DEFAULT 1
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER DEFAULT 1
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

DISTKEY

Beschreibung

In Amazon Redshift wird DISTKEY verwendet, um die Daten auf die Clusterknoten zu verteilen und so die Abfrageleistung zu optimieren. Snowflake hingegen kümmert sich automatisch um die Verteilung und Speicherung von Daten, ohne dass explizite Verteilungsschlüssel benötigt werden. Aufgrund der unterschiedlichen Architektur und Datenverwaltungsansätze hat Snowflake kein direktes Äquivalent zu DISTKEY von Redshift. Aus diesen Gründen wird die Anweisung DISTKEY während des Transformationsprozesses entfernt

See the Redshift data distribution documentation for this syntax.

Grammatikalische Syntax

 DISTKEY

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER DISTKEY
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

ENCODE

Beschreibung

Die Komprimierungskodierung für eine Spalte. In Snowflake ist es nicht notwendig, ENCODE zu definieren, da die Datenkomprimierung automatisch erfolgt, im Gegensatz zu Redshift, das manuelle Kodierungseinstellungen erfordert. Aus diesem Grund wird die Anweisung ENCODE während der Migration entfernt.

See the Redshift CREATE TABLE ENCODE clause documentation for this syntax.

Grammatikalische Syntax

 ENCODE encoding

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER ENCODE DELTA
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

GENERATED BY DEFAULT AS IDENTITY

Beschreibung

Gibt an, dass es sich bei der Spalte um eine Standardspalte IDENTITY handelt und ermöglicht es Ihnen, der Spalte automatisch einen eindeutigen Wert zuzuweisen.

See the Redshift IDENTITY column documentation for this syntax.

Grammatikalische Syntax

 GENERATED BY DEFAULT AS IDENTITY ( seed, step )

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER GENERATED BY DEFAULT AS IDENTITY(1,1)
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER IDENTITY(1,1) ORDER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}'
;

Zugehörige EWIs

Es gibt keine bekannten Probleme.

IDENTITY

Beschreibung

Klausel, die angibt, dass die Spalte eine IDENTITY-Spalte ist. ([RedShift SQL-Referenz Identität](https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW. html#identity-clause)).

Grammatikalische Syntax

 IDENTITY ( seed, step )

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    doc INTEGER,
    id1 INTEGER IDENTITY(1,1),
    id2 INTEGER  DEFAULT "identity"(674435, 0, ('5,3'::character varying)::text),
    id3 INTEGER  DEFAULT default_identity(963861, 1, '1,2'::text),
    id4 INTEGER  DEFAULT "default_identity"(963861, 1, '1,6'::text)
);

INSERT INTO table1 (doc) VALUES (1),(2),(3);

SELECT * FROM table1;
Ergebnisse

DOC

ID1

ID2

ID3

ID4

1

1

5

1

1

2

2

8

3

7

3

3

11

5

13

Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    doc INTEGER,
    id1 INTEGER IDENTITY(1,1) ORDER,
    id2 INTEGER IDENTITY(5,3) ORDER,
    id3 INTEGER IDENTITY(1,2) ORDER,
    id4 INTEGER IDENTITY(1,6) ORDER
)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "12/04/2024",  "domain": "test" }}';

INSERT INTO table1 (doc) VALUES (1),(2),(3);

SELECT * FROM
 table1;
Ergebnisse

DOC

ID1

ID2

ID3

ID4

1

1

5

1

1

2

2

8

3

7

3

3

11

5

13

Bekannte Probleme

Es wurden keine Probleme gefunden.

Zugehörige EWIs

Es gibt keine bekannten Probleme.

SORTKEY

Beschreibung

Das Schlüsselwort, das angibt, dass die Spalte der Sortierschlüssel für die Tabelle ist. In Snowflake kann SORTKEY von Redshift auf CLUSTER BY migriert werden, da beide den Datenspeicher für die Abfrageleistung optimieren. CLUSTER BY in Snowflake organisiert die Daten nach bestimmten Spalten, ähnlich wie SORTKEY die Daten in Redshift ordnet.

See the Redshift data sorting documentation for this syntax.

Grammatikalische Syntax

 SORTKEY

Beispielhafte Quellcode-Muster

Eingabecode:

Redshift
 CREATE TABLE table1 (
    col1 INTEGER SORTKEY
);
Ausgabecode:
Snowflake
 CREATE TABLE table1 (
    col1 INTEGER
)
--** SSC-FDM-RS0002 - THE PERFORMANCE OF CLUSTER BY IN SNOWFLAKE MAY VARY COMPARED TO THE PERFORMANCE OF SORTKEY IN REDSHIFT. **
CLUSTER BY (col1)
COMMENT = '{ "origin": "sf_sc", "name": "snowconvert", "version": {  "major": 0,  "minor": 0,  "patch": "0" }, "attributes": {  "component": "redshift",  "convertedOn": "09/17/2024" }}';

Bekannte Probleme

  1. SSC-FDM-RS0002: The performance of CLUSTER BY in Snowflake may vary compared to the performance of SORTKEY in Redshift.