@dbml/core 5.3.0 → 5.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +0 -0
- package/README.md +201 -1
- package/lib/export/DbmlExporter.js +5 -1
- package/lib/export/JsonExporter.js +0 -0
- package/lib/export/ModelExporter.js +0 -0
- package/lib/export/MysqlExporter.js +0 -0
- package/lib/export/OracleExporter.js +0 -0
- package/lib/export/PostgresExporter.js +0 -0
- package/lib/export/README.md +0 -0
- package/lib/export/SqlServerExporter.js +0 -0
- package/lib/export/index.js +0 -0
- package/lib/export/utils.js +0 -0
- package/lib/import/index.js +0 -0
- package/lib/index.js +7 -0
- package/lib/model_structure/check.js +0 -0
- package/lib/model_structure/config.js +0 -0
- package/lib/model_structure/database.js +0 -0
- package/lib/model_structure/dbState.js +0 -0
- package/lib/model_structure/element.js +0 -0
- package/lib/model_structure/endpoint.js +0 -0
- package/lib/model_structure/enum.js +0 -0
- package/lib/model_structure/enumValue.js +0 -0
- package/lib/model_structure/field.js +0 -0
- package/lib/model_structure/indexColumn.js +0 -0
- package/lib/model_structure/indexes.js +0 -0
- package/lib/model_structure/ref.js +0 -0
- package/lib/model_structure/schema.js +0 -0
- package/lib/model_structure/stickyNote.js +0 -0
- package/lib/model_structure/table.js +0 -0
- package/lib/model_structure/tableGroup.js +0 -0
- package/lib/model_structure/tablePartial.js +0 -0
- package/lib/model_structure/utils.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/AST.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/ParserErrorListener.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/SyntaxError.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/constants.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/helpers.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/index.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/MssqlASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mssql/README.md +263 -157
- package/lib/parse/ANTLR/ASTGeneration/mysql/MySQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/mysql/README.md +262 -157
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/OracleSQLASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/oraclesql/README.md +261 -157
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLLexerBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgreSQLParserBase.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/PostgresASTGen.js +0 -0
- package/lib/parse/ANTLR/ASTGeneration/postgres/README.md +252 -157
- package/lib/parse/ANTLR/ASTGeneration/snowflake/README.md +236 -157
- package/lib/parse/ANTLR/ASTGeneration/snowflake/SnowflakeASTGen.js +0 -0
- package/lib/parse/ANTLR/README.md +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mssql/TSqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlLexerBase.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/mysql/MySqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlLexerBase.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserBase.js +0 -0
- package/lib/parse/ANTLR/parsers/oraclesql/OracleSqlParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/PostgreSQLParserVisitor.js +0 -0
- package/lib/parse/ANTLR/parsers/postgresql/README.md +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeLexer.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.g4 +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.interp +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.js +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParser.tokens +0 -0
- package/lib/parse/ANTLR/parsers/snowflake/SnowflakeParserVisitor.js +0 -0
- package/lib/parse/Parser.js +0 -0
- package/lib/parse/buildParser.js +0 -0
- package/lib/parse/databaseGenerator.js +0 -0
- package/lib/parse/dbml/parser.pegjs +0 -0
- package/lib/parse/dbmlParser.js +0 -0
- package/lib/parse/error.js +0 -0
- package/lib/parse/mssql/base_parsers.js +0 -0
- package/lib/parse/mssql/column_definition/actions.js +0 -0
- package/lib/parse/mssql/column_definition/index.js +0 -0
- package/lib/parse/mssql/constraint_definition/actions.js +0 -0
- package/lib/parse/mssql/constraint_definition/index.js +0 -0
- package/lib/parse/mssql/expression.js +0 -0
- package/lib/parse/mssql/fk_definition/actions.js +0 -0
- package/lib/parse/mssql/fk_definition/index.js +0 -0
- package/lib/parse/mssql/index.js +0 -0
- package/lib/parse/mssql/index_definition/actions.js +0 -0
- package/lib/parse/mssql/index_definition/index.js +0 -0
- package/lib/parse/mssql/keyword_parsers.js +0 -0
- package/lib/parse/mssql/keyword_utils.js +0 -0
- package/lib/parse/mssql/statements/actions.js +0 -0
- package/lib/parse/mssql/statements/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/add/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/alter_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/comments/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_index/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/actions.js +0 -0
- package/lib/parse/mssql/statements/statement_types/create_table/index.js +0 -0
- package/lib/parse/mssql/statements/statement_types/index.js +0 -0
- package/lib/parse/mssql/utils.js +0 -0
- package/lib/parse/mssql/whitespaces.js +0 -0
- package/lib/parse/mssqlParser.js +0 -0
- package/lib/parse/mysql/parser.pegjs +0 -0
- package/lib/parse/mysqlParser.js +0 -0
- package/lib/parse/postgresParser.js +0 -0
- package/lib/parse/postgresql/Base_rules.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Alter_table/Alter_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Commands.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Comment.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_index.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_normal.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_table/Create_table_partition_of.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_enum.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Create_type/Create_type_range.pegjs +0 -0
- package/lib/parse/postgresql/Commands/Ignore_syntax.pegjs +0 -0
- package/lib/parse/postgresql/Expression.pegjs +0 -0
- package/lib/parse/postgresql/InitializerUtils.pegjs +0 -0
- package/lib/parse/postgresql/Keywords.pegjs +0 -0
- package/lib/parse/postgresql/get_parser.js +0 -0
- package/lib/parse/postgresql/parser.pegjs +0 -0
- package/lib/parse/schemarb/parser.pegjs +0 -0
- package/lib/parse/schemarbParser.js +0 -0
- package/lib/transform/index.js +30 -0
- package/lib/utils/version.js +0 -0
- package/package.json +3 -3
- package/types/export/ModelExporter.d.ts +0 -0
- package/types/export/index.d.ts +0 -0
- package/types/import/index.d.ts +0 -0
- package/types/index.d.ts +2 -1
- package/types/model_structure/check.d.ts +0 -0
- package/types/model_structure/database.d.ts +0 -0
- package/types/model_structure/dbState.d.ts +0 -0
- package/types/model_structure/element.d.ts +0 -0
- package/types/model_structure/endpoint.d.ts +0 -0
- package/types/model_structure/enum.d.ts +0 -0
- package/types/model_structure/enumValue.d.ts +0 -0
- package/types/model_structure/field.d.ts +0 -0
- package/types/model_structure/indexColumn.d.ts +0 -0
- package/types/model_structure/indexes.d.ts +0 -0
- package/types/model_structure/ref.d.ts +0 -0
- package/types/model_structure/schema.d.ts +0 -0
- package/types/model_structure/stickyNote.d.ts +0 -0
- package/types/model_structure/table.d.ts +0 -0
- package/types/model_structure/tableGroup.d.ts +0 -0
- package/types/model_structure/tablePartial.d.ts +0 -0
- package/types/parse/Parser.d.ts +0 -0
- package/types/parse/error.d.ts +0 -0
- package/types/transform/index.d.ts +7 -0
|
@@ -1,157 +1,236 @@
|
|
|
1
|
-
# Snowflake
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
|
45
|
-
|
|
46
|
-
|
|
|
47
|
-
|
|
|
48
|
-
|
|
|
49
|
-
|
|
|
50
|
-
|
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
|
59
|
-
|
|
60
|
-
|
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
|
81
|
-
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
|
87
|
-
|
|
|
88
|
-
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
|
93
|
-
|
|
94
|
-
|
|
|
95
|
-
|
|
|
96
|
-
|
|
|
97
|
-
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
|
102
|
-
|
|
103
|
-
|
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
|
111
|
-
|
|
112
|
-
|
|
|
113
|
-
|
|
|
114
|
-
|
|
|
115
|
-
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
|
120
|
-
|
|
121
|
-
|
|
|
122
|
-
|
|
|
123
|
-
|
|
|
124
|
-
|
|
|
125
|
-
|
|
|
126
|
-
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
|
131
|
-
|
|
132
|
-
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
|
137
|
-
|
|
138
|
-
|
|
|
139
|
-
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
|
146
|
-
|
|
147
|
-
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
|
154
|
-
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
1
|
+
# Snowflake SQL Parser Support
|
|
2
|
+
|
|
3
|
+
> Comprehensive documentation for the Snowflake model structure generator based on the ANTLR4 parser.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This module provides SQL parsing capabilities for Snowflake databases, enabling conversion of Snowflake DDL statements to DBML format. The parser supports Snowflake-specific syntax including `IDENTITY` columns with increment ranges. Note that Snowflake, as a cloud data warehouse, does not support traditional indexes, and the parser has known issues with `FOREIGN KEY` and `CHECK` constraints.
|
|
8
|
+
|
|
9
|
+
## Support Legend
|
|
10
|
+
|
|
11
|
+
| Symbol | Meaning |
|
|
12
|
+
|--------|---------|
|
|
13
|
+
| ✓ | Fully supported and correctly parsed |
|
|
14
|
+
| ◐ | Valid SQL that is parsed, but some options/clauses are ignored |
|
|
15
|
+
| ✗ | Valid Snowflake syntax, but the parser fails to generate output |
|
|
16
|
+
| — | Syntax not valid in Snowflake |
|
|
17
|
+
|
|
18
|
+
## Key Capabilities
|
|
19
|
+
|
|
20
|
+
- **Data Definition**
|
|
21
|
+
- `CREATE TABLE` with basic syntax support
|
|
22
|
+
- Data types: parameterized types (e.g., `VARCHAR(255)`, `NUMBER(10,2)`)
|
|
23
|
+
- **Constraints**
|
|
24
|
+
- `PRIMARY KEY` (column-level, table-level, multi-column, with explicit name)
|
|
25
|
+
- `UNIQUE` (column-level, table-level, multi-column)
|
|
26
|
+
- `DEFAULT`, `NOT NULL`
|
|
27
|
+
- `FOREIGN KEY`: **Not Supported** (known bug)
|
|
28
|
+
- `CHECK`: **Not Supported** (parse failure)
|
|
29
|
+
- **Auto-increment**
|
|
30
|
+
- `IDENTITY` with increment range (e.g., `IDENTITY(1,1)`)
|
|
31
|
+
- **Indexes**
|
|
32
|
+
- N/A (Snowflake does not support user-defined indexes)
|
|
33
|
+
- **Comments**
|
|
34
|
+
- Table comments only (column comments not supported)
|
|
35
|
+
- **Data Manipulation**
|
|
36
|
+
- Multi-row `INSERT` only
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Feature Support Matrix
|
|
41
|
+
|
|
42
|
+
### `CREATE TABLE`
|
|
43
|
+
|
|
44
|
+
| Feature | Status | Notes |
|
|
45
|
+
|---------|---------|-------|
|
|
46
|
+
| Basic `CREATE TABLE` syntax | ✓ | |
|
|
47
|
+
| Enumerated data types | — | Not supported in Snowflake |
|
|
48
|
+
| Parameterized types `name(...)` | ✓ | e.g., `VARCHAR(255)`, `NUMBER(10,2)` |
|
|
49
|
+
| Array types `name[...]` | — | Snowflake uses ARRAY type differently |
|
|
50
|
+
| TEMPORARY tables | ◐ | Parsed but no indication of temporary status |
|
|
51
|
+
| `CREATE TABLE` AS SELECT | ✗ | |
|
|
52
|
+
| Table options (CLUSTER BY, etc.) | ◐ | Options are ignored |
|
|
53
|
+
|
|
54
|
+
### Constraints
|
|
55
|
+
|
|
56
|
+
#### `PRIMARY KEY`
|
|
57
|
+
|
|
58
|
+
| Feature | Status | Notes |
|
|
59
|
+
|---------|---------|-------|
|
|
60
|
+
| Column-level `PRIMARY KEY` | ✓ | `id INT PRIMARY KEY` |
|
|
61
|
+
| Table-level `PRIMARY KEY` | ✓ | `PRIMARY KEY (id)` |
|
|
62
|
+
| Multi-column `PRIMARY KEY` | ✓ | `PRIMARY KEY (a, b)` |
|
|
63
|
+
| Explicitly named (CONSTRAINT name) | ✓ | `CONSTRAINT pk_name PRIMARY KEY (id)` |
|
|
64
|
+
| RELY / NORELY options | ◐ | Constraint enforcement hints are ignored |
|
|
65
|
+
|
|
66
|
+
#### `FOREIGN KEY`
|
|
67
|
+
|
|
68
|
+
| Feature | Status | Notes |
|
|
69
|
+
|---------|---------|-------|
|
|
70
|
+
| Column-level `FOREIGN KEY` | ✗ | Known bug - produces undefined error |
|
|
71
|
+
| Table-level `FOREIGN KEY` | ✗ | Known bug - produces undefined error |
|
|
72
|
+
| Multi-column `FOREIGN KEY` | ✗ | Known bug - produces undefined error |
|
|
73
|
+
| Explicitly named (CONSTRAINT name) | ✗ | Known bug - produces undefined error |
|
|
74
|
+
| `ON UPDATE` action | ✗ | Known bug - produces undefined error |
|
|
75
|
+
| `ON DELETE` action | ✗ | Known bug - produces undefined error |
|
|
76
|
+
| Constraint options | ✗ | Known bug - produces undefined error |
|
|
77
|
+
|
|
78
|
+
#### `UNIQUE`
|
|
79
|
+
|
|
80
|
+
| Feature | Status | Notes |
|
|
81
|
+
|---------|---------|-------|
|
|
82
|
+
| Column-level `UNIQUE` | ✓ | `col INT UNIQUE` |
|
|
83
|
+
| Table-level `UNIQUE` | ✓ | `UNIQUE (col)` |
|
|
84
|
+
| Multi-column `UNIQUE` | ✓ | `UNIQUE (a, b)` |
|
|
85
|
+
| Explicitly named (CONSTRAINT name) | ◐ | Name is ignored in output |
|
|
86
|
+
| Constraint options | ◐ | Options are ignored |
|
|
87
|
+
| NULLS NOT DISTINCT | — | Not valid in Snowflake |
|
|
88
|
+
| `UNIQUE KEY`/`UNIQUE INDEX` | — | MySQL syntax - not valid in Snowflake |
|
|
89
|
+
|
|
90
|
+
#### `CHECK`
|
|
91
|
+
|
|
92
|
+
| Feature | Status | Notes |
|
|
93
|
+
|---------|---------|-------|
|
|
94
|
+
| Column-level `CHECK` | ✗ | `CHECK (col > 0)` - parse failure |
|
|
95
|
+
| Table-level `CHECK` | ✗ | Parse failure |
|
|
96
|
+
| Explicitly named (CONSTRAINT name) | ✗ | Parse failure |
|
|
97
|
+
| Enforcement options | ✗ | Parse failure |
|
|
98
|
+
|
|
99
|
+
#### `DEFAULT`
|
|
100
|
+
|
|
101
|
+
| Feature | Status | Notes |
|
|
102
|
+
|---------|---------|-------|
|
|
103
|
+
| Column-level `DEFAULT` | ✓ | `col INT DEFAULT 0` |
|
|
104
|
+
| Table-level `DEFAULT` | ✗ | Parse failure |
|
|
105
|
+
| Function as `DEFAULT` | ✓ | `DEFAULT CURRENT_TIMESTAMP()` |
|
|
106
|
+
| Explicitly named `DEFAULT` | ◐ | Name is ignored in output |
|
|
107
|
+
|
|
108
|
+
#### `NOT NULL` / NULL
|
|
109
|
+
|
|
110
|
+
| Feature | Status | Notes |
|
|
111
|
+
|---------|---------|-------|
|
|
112
|
+
| Column-level `NOT NULL` | ✓ | |
|
|
113
|
+
| NULL attribute | ✓ | |
|
|
114
|
+
| Table-level `NOT NULL` | — | |
|
|
115
|
+
| Constraint options | ◐ | Options are ignored |
|
|
116
|
+
|
|
117
|
+
### Auto-Increment Columns
|
|
118
|
+
|
|
119
|
+
| Feature | Status | Notes |
|
|
120
|
+
|---------|---------|-------|
|
|
121
|
+
| `IDENTITY` (column property) | ✓ | `id INT IDENTITY(1,1)` |
|
|
122
|
+
| Increment range | ✓ | `IDENTITY(start, increment)` syntax |
|
|
123
|
+
| `AUTO_INCREMENT` (column attribute) | — | MySQL syntax - not valid in Snowflake |
|
|
124
|
+
| `SERIAL` (pseudo-type) | — | PostgreSQL syntax - not valid in Snowflake |
|
|
125
|
+
| `BIGSERIAL` (pseudo-type) | — | PostgreSQL syntax - not valid in Snowflake |
|
|
126
|
+
| `GENERATED AS IDENTITY` (column property) | ✗ | SQL standard syntax - parse failure |
|
|
127
|
+
|
|
128
|
+
### Inline Indexes (in `CREATE TABLE`)
|
|
129
|
+
|
|
130
|
+
| Feature | Status | Notes |
|
|
131
|
+
|---------|---------|-------|
|
|
132
|
+
| All index features | — | Snowflake does not support user-defined indexes |
|
|
133
|
+
|
|
134
|
+
### Table/Column Comments (in `CREATE TABLE`)
|
|
135
|
+
|
|
136
|
+
| Feature | Status | Notes |
|
|
137
|
+
|---------|---------|-------|
|
|
138
|
+
| Table `COMMENT` attribute | ✓ | |
|
|
139
|
+
| Column `COMMENT` attribute | ✗ | |
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
### `CREATE INDEX`
|
|
144
|
+
|
|
145
|
+
| Feature | Status | Notes |
|
|
146
|
+
|---------|---------|-------|
|
|
147
|
+
| All index features | — | Snowflake does not support `CREATE INDEX` |
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### `INSERT` Statements
|
|
152
|
+
|
|
153
|
+
| Feature | Status | Notes |
|
|
154
|
+
|---------|---------|-------|
|
|
155
|
+
| Basic `INSERT` ... VALUES | ✗ | |
|
|
156
|
+
| Multi-row `INSERT` | ✓ | |
|
|
157
|
+
| `INSERT` ... SELECT | ✗ | |
|
|
158
|
+
| WITH clause (CTE) | ✗ | |
|
|
159
|
+
| Target table alias | — | |
|
|
160
|
+
| `INSERT` ... RETURNING | — | |
|
|
161
|
+
| `INSERT` OVERWRITE | ✗ | |
|
|
162
|
+
| Multi-table `INSERT` | ✗ | |
|
|
163
|
+
| Conditional `INSERT` (WHEN/FIRST/ALL) | ✗ | |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### `ALTER TABLE`
|
|
168
|
+
|
|
169
|
+
| Feature | Status | Notes |
|
|
170
|
+
|---------|---------|-------|
|
|
171
|
+
| **ADD COLUMN** | | |
|
|
172
|
+
| - All column properties | ✗ | |
|
|
173
|
+
| **DROP COLUMN** | ✗ | |
|
|
174
|
+
| **ALTER COLUMN / MODIFY** | | |
|
|
175
|
+
| - `COMMENT` | ✗ | |
|
|
176
|
+
| - Other modifications | ✗ | |
|
|
177
|
+
| **RENAME COLUMN** | ✗ | |
|
|
178
|
+
| **ADD CONSTRAINT** | | |
|
|
179
|
+
| - Named `CHECK` | — | Snowflake uses SET/UNSET for constraints |
|
|
180
|
+
| - Unnamed `CHECK` | — | |
|
|
181
|
+
| - Named `UNIQUE` | ◐ | Name is ignored |
|
|
182
|
+
| - Unnamed `UNIQUE` | ✓ | |
|
|
183
|
+
| - Named `PRIMARY KEY` | ✗ | |
|
|
184
|
+
| - Unnamed `PRIMARY KEY` | ✗ | |
|
|
185
|
+
| - Named `FOREIGN KEY` | ◐ | Name is ignored |
|
|
186
|
+
| - Unnamed `FOREIGN KEY` | ✓ | |
|
|
187
|
+
| - `DEFAULT` | ✗ | Parse failure |
|
|
188
|
+
| - `NOT NULL` / NULL | ✗ | |
|
|
189
|
+
| **DROP CONSTRAINT** | ✗ | |
|
|
190
|
+
| **ALTER CONSTRAINT** | ✗ | |
|
|
191
|
+
| **RENAME TABLE** | ✗ | |
|
|
192
|
+
| **SET SCHEMA** | ✗ | |
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
### Other DDL Statements
|
|
197
|
+
|
|
198
|
+
| Feature | Status | Notes |
|
|
199
|
+
|---------|---------|-------|
|
|
200
|
+
| `DROP TABLE` | ✗ | |
|
|
201
|
+
| `DROP INDEX` | — | No indexes in Snowflake |
|
|
202
|
+
| `ALTER INDEX` | — | No indexes in Snowflake |
|
|
203
|
+
| `CREATE VIEW` | ✗ | |
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
### Comments (Standalone Statements)
|
|
208
|
+
|
|
209
|
+
| Feature | Status | Notes |
|
|
210
|
+
|---------|---------|-------|
|
|
211
|
+
| `COMMENT ON TABLE` | ✗ | |
|
|
212
|
+
| `COMMENT ON COLUMN` | ✗ | |
|
|
213
|
+
| COMMENT ... IS NULL | — | Use `ALTER TABLE ... SET/UNSET COMMENT` |
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Known Limitations
|
|
218
|
+
|
|
219
|
+
- **`FOREIGN KEY` constraints**: All `FOREIGN KEY` definitions fail with undefined errors
|
|
220
|
+
- **`CHECK` constraints**: All `CHECK` constraint definitions fail to parse
|
|
221
|
+
- **Column comments**: Column-level comments are not supported
|
|
222
|
+
- **Basic `INSERT`**: Single-row `INSERT` without parentheses may fail; use multi-row `INSERT` syntax
|
|
223
|
+
- **`ALTER TABLE` operations**: Very limited support
|
|
224
|
+
- **`CREATE VIEW`**: View definitions are not parsed
|
|
225
|
+
- **Indexes**: Not applicable to Snowflake (cloud DW architecture)
|
|
226
|
+
- **`GENERATED AS IDENTITY`**: SQL standard syntax not supported; use `IDENTITY(start, increment)` instead
|
|
227
|
+
|
|
228
|
+
## Snowflake-Specific Notes
|
|
229
|
+
|
|
230
|
+
1. **`IDENTITY` Columns**: Snowflake uses `IDENTITY(start, increment)` syntax for auto-increment, e.g., `IDENTITY(1,1)`. This is supported with increment range
|
|
231
|
+
2. **No Indexes**: Snowflake is a cloud data warehouse that does not support traditional indexes. All index-related features are marked N/A
|
|
232
|
+
3. **`FOREIGN KEY` Issues**: There is a known bug where all `FOREIGN KEY` constraint definitions produce `(undefined:undefined) undefined` errors
|
|
233
|
+
4. **`CHECK` Constraints**: `CHECK` constraints are valid in Snowflake SQL but currently fail to parse
|
|
234
|
+
5. **Comments**: Use inline `COMMENT` in `CREATE TABLE` for table comments. Column comments have parsing issues
|
|
235
|
+
6. **Data Types**: Snowflake has its own type system; common types like `VARCHAR`, `NUMBER`, `TIMESTAMP` are fully supported
|
|
236
|
+
7. **Constraint Enforcement**: Snowflake's constraint options like `RELY`/`NORELY`, `ENFORCED`/`NOT ENFORCED` are parsed but ignored
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/Parser.js
CHANGED
|
File without changes
|
package/lib/parse/buildParser.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/dbmlParser.js
CHANGED
|
File without changes
|
package/lib/parse/error.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/parse/mssql/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|