Skip to content

Commit

Permalink
fix: drop table sql
Browse files Browse the repository at this point in the history
  • Loading branch information
rkawajiri committed Oct 19, 2023
1 parent d2222d5 commit b47363d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,12 @@ def visit_drop_table(self, drop_table, **kw):
for index in drop_table.element.indexes:
indexes += "DROP INDEX {};".format(self.preparer.quote(index.name))

return indexes + constrs + str(drop_table)
text = "\nDROP TABLE "
if drop_table.if_exists:
text += "IF EXISTS "
text += self.preparer.format_table(drop_table.element)

return indexes + constrs + text

def visit_primary_key_constraint(self, constraint, **kw):
"""Build primary key definition.
Expand Down

0 comments on commit b47363d

Please sign in to comment.