Skip to content

Commit a762993

Browse files
authored
feat(generator): unsupported warning for T-SQL query option (#4972)
1 parent 1353b79 commit a762993

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

sqlglot/generator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,6 +2581,7 @@ def options_modifier(self, expression: exp.Expression) -> str:
25812581
return f" {options}" if options else ""
25822582

25832583
def queryoption_sql(self, expression: exp.QueryOption) -> str:
2584+
self.unsupported("Unsupported query option.")
25842585
return ""
25852586

25862587
def offset_limit_modifiers(

tests/dialects/test_tsql.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,14 @@ def test_option(self):
559559
with self.assertRaises(ParseError, msg=f"When running '{query}'"):
560560
self.parse_one(query)
561561

562+
self.validate_all(
563+
"SELECT col FROM t OPTION(LABEL = 'foo')",
564+
write={
565+
"tsql": "SELECT col FROM t OPTION(LABEL = 'foo')",
566+
"databricks": UnsupportedError,
567+
},
568+
)
569+
562570
def test_types(self):
563571
self.validate_identity("CAST(x AS XML)")
564572
self.validate_identity("CAST(x AS UNIQUEIDENTIFIER)")

0 commit comments

Comments
 (0)