Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions ydb_sqlalchemy/sqlalchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down