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

Conversation

ankiaga
Copy link
Contributor

@ankiaga ankiaga commented Feb 5, 2024

@@ -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

@ankiaga ankiaga added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 6, 2024
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Feb 6, 2024
@ankiaga ankiaga merged commit 628d26c into main Feb 7, 2024
14 checks passed
@ankiaga ankiaga deleted the drop_table_fix branch February 7, 2024 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner-sqlalchemy API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants