summaryrefslogtreecommitdiffstats
path: root/sqlglot/dialects/teradata.py
diff options
context:
space:
mode:
Diffstat (limited to 'sqlglot/dialects/teradata.py')
-rw-r--r--sqlglot/dialects/teradata.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/sqlglot/dialects/teradata.py b/sqlglot/dialects/teradata.py
index 9b39178..514aecb 100644
--- a/sqlglot/dialects/teradata.py
+++ b/sqlglot/dialects/teradata.py
@@ -183,3 +183,20 @@ class Teradata(Dialect):
each_sql = f" EACH {each_sql}" if each_sql else ""
return f"RANGE_N({this} BETWEEN {expressions_sql}{each_sql})"
+
+ def createable_sql(
+ self,
+ expression: exp.Create,
+ locations: dict[exp.Properties.Location, list[exp.Property]],
+ ) -> str:
+ kind = self.sql(expression, "kind").upper()
+ if kind == "TABLE" and locations.get(exp.Properties.Location.POST_NAME):
+ this_name = self.sql(expression.this, "this")
+ this_properties = self.properties(
+ exp.Properties(expressions=locations[exp.Properties.Location.POST_NAME]),
+ wrapped=False,
+ prefix=",",
+ )
+ this_schema = self.schema_columns_sql(expression.this)
+ return f"{this_name}{this_properties}{self.sep()}{this_schema}"
+ return super().createable_sql(expression, locations)