Repository navigation
Conversation
Primary key column names and interleaved parent table names in generated CREATE TABLE statements were previously inserted verbatim without identifier quoting. As a result, reserved keywords or special characters could produce invalid DDL, and untrusted names could break out into additional SQL or DDL statements. This change: - Quotes primary key column names consistently with the table's column definitions. - Quotes interleaved parent table names, formats table objects cleanly (including schema-qualified parents), and rejects invalid non-string, non-table values. - Adds unit tests covering quoting, interleaved table options, invalid input handling, and DDL injection prevention, along with a skipped test case for escaped backticks, backslashes, and newlines pending identifier escaping support.
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the security and robustness of table creation in the Spanner SQLAlchemy dialect. It updates the post_create_table method to properly quote primary key columns and parent tables in INTERLEAVE IN PARENT clauses, mitigating potential DDL injection vulnerabilities. It also introduces type annotations and stricter type validation for the spanner_interleave_in parameter. Furthermore, a comprehensive set of unit tests has been added to verify quoting behavior, type safety, and injection prevention. I have no additional feedback to provide as the implementation is clean and well-tested.
parthea
reviewed
Nov 26, 2026
parthea
reviewed
Nov 26, 2026
parthea
approved these changes
Nov 26, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Primary key column names and interleaved parent table names in generated CREATE TABLE statements were previously inserted verbatim without identifier quoting. As a result, reserved keywords or special characters could produce invalid DDL, and untrusted names could break out into additional SQL or DDL statements.
This change: