Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Table name should be quoted by back quotes (`) on DROP TABLE #385

Merged
merged 2 commits into from
Feb 7, 2024
Merged
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
2 changes: 1 addition & 1 deletion google/cloud/sqlalchemy_spanner/sqlalchemy_spanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ 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)
return indexes + constrs + super().visit_drop_table(drop_table)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the same strategy for quoting identifiers for all operations in this method (and probably also in the entire file). In this method, it seems that most identifiers are quoted using preparer.quote(..).

Example: "DROP INDEX {};".format(self.preparer.quote(index.name)). Should we do that here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.preparer.quote (its a super class variable not overridden here) is the correct way as internally super().visit_drop_table() also calls self.preparer.quote


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