diff options
Diffstat (limited to '')
-rw-r--r-- | sqlglot/generator.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sqlglot/generator.py b/sqlglot/generator.py index 6871dd8..8a49d55 100644 --- a/sqlglot/generator.py +++ b/sqlglot/generator.py @@ -466,6 +466,12 @@ class Generator: if part ) + def columnposition_sql(self, expression: exp.ColumnPosition) -> str: + this = self.sql(expression, "this") + this = f" {this}" if this else "" + position = self.sql(expression, "position") + return f"{position}{this}" + def columndef_sql(self, expression: exp.ColumnDef) -> str: column = self.sql(expression, "this") kind = self.sql(expression, "kind") @@ -473,8 +479,10 @@ class Generator: exists = "IF NOT EXISTS " if expression.args.get("exists") else "" kind = f" {kind}" if kind else "" constraints = f" {constraints}" if constraints else "" + position = self.sql(expression, "position") + position = f" {position}" if position else "" - return f"{exists}{column}{kind}{constraints}" + return f"{exists}{column}{kind}{constraints}{position}" def columnconstraint_sql(self, expression: exp.ColumnConstraint) -> str: this = self.sql(expression, "this") @@ -1591,6 +1599,11 @@ class Generator: exp.Case(ifs=[expression.copy()], default=expression.args.get("false")) ) + def matchagainst_sql(self, expression: exp.MatchAgainst) -> str: + modifier = expression.args.get("modifier") + modifier = f" {modifier}" if modifier else "" + return f"{self.func('MATCH', *expression.expressions)} AGAINST({self.sql(expression, 'this')}{modifier})" + def jsonkeyvalue_sql(self, expression: exp.JSONKeyValue) -> str: return f"{self.sql(expression, 'this')}: {self.sql(expression, 'expression')}" |