-
Notifications
You must be signed in to change notification settings - Fork 1.1k
TSQL: table structure options for Azure Synapse not supported #7428
Copy link
Copy link
Closed as not planned
Description
Azure Synapse Dedicated SQL Pool uses TSQL dialect, with some additions:
For CREATE TABLE the "structure" of the table (heap, clustered column store, clustered index) can be specified directly.
This seems not to be supported by sqlglot as of version 30.1.0.
Fully reproducible code snippet
import sqlglot
sqlglot.parse_one(
read="tsql",
sql="CREATE TABLE t1 (id INT) WITH (HEAP)",
) # ✅ works
sqlglot.parse_one(
read="tsql",
sql="CREATE TABLE t1 (id INT) WITH (CLUSTERED COLUMNSTORE INDEX)",
) # ❌ fails
sqlglot.parse_one(
read="tsql",
sql="CREATE TABLE t1 (id INT) WITH (CLUSTERED INDEX (id))",
) # ❌ failssqlglot.errors.ParseError: Expecting (. Line 1, Col: 52.
CREATE TABLE t1 (id INT) WITH (CLUSTERED COLUMNSTORE INDEX)
Official Documentation
https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-azure-sql-data-warehouse?view=azure-sqldw-latest#table-structure-options
I tried to define a custom dialect, but it did not help
import sqlglot
from sqlglot import TokenType
from sqlglot.dialects.tsql import TSQL
from sqlglot.tokens import Tokenizer
class DsqlDialect(TSQL):
class Tokenizer(Tokenizer):
KEYWORDS = {
**Tokenizer.KEYWORDS,
"CLUSTERED COLUMNSTORE INDEX": TokenType.INDEX,
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels