diff --git a/ydb_sqlalchemy/sqlalchemy/__init__.py b/ydb_sqlalchemy/sqlalchemy/__init__.py index adb286c..00a1101 100644 --- a/ydb_sqlalchemy/sqlalchemy/__init__.py +++ b/ydb_sqlalchemy/sqlalchemy/__init__.py @@ -212,8 +212,25 @@ def visit_not_regexp_match_op_binary(self, binary, operator, **kw): class YqlDDLCompiler(DDLCompiler): - pass - + def visit_foreign_key_constraint(self, constraint): + return None + + def visit_primary_key_constraint(self, constraint, **kwargs): + if len(constraint) == 0: + return "" + text = "" + text += "PRIMARY KEY " + text += "(%s)" % ", ".join( + self.preparer.quote(c.name) + for c in ( + constraint.columns_autoinc_first + if constraint._implicit_generated + else constraint.columns + ) + ) + text += self.define_constraint_deferrability(constraint) + return text + def upsert(table): return sa.sql.Insert(table)