Fix escaping of special characters or reserved words as column names in dialects of common sql provider#45640
Merged
eladkal merged 53 commits intoJan 26, 2025
Conversation
… the generate_replace_sql method of MSSQLDialect
…scaped but also make sure any special character is escaped, not only dots or reserved words
Contributor
Author
|
@eladkal Would it hurt if some methods in Dialects are being renamed? I don't think it's actually used yet by any released provider right? I'm thinking of renaming following 2 methods: escape_colmun_name -> escape_word |
…mn_name to unescape_word in Dialects class
…replace_statement_format to be defined in extra of connection
…catenated as one word
… if those aren't reserved words or contain special characters
… of cached property
eladkal
approved these changes
Jan 24, 2025
Contributor
|
cc @potiuk any comments on this one? If not happy to merge it |
Contributor
|
@dabla can you rebase and resolve conflicts? I will merge after |
Contributor
Author
just rebased and merged with main |
potiuk
approved these changes
Jan 26, 2025
got686-yandex
pushed a commit
to got686-yandex/airflow
that referenced
this pull request
Jan 30, 2025
…in dialects of common sql provider (apache#45640) * refactor: Make sure reserved words in column names are all escaped in the generate_replace_sql method of MSSQLDialect --------- Co-authored-by: David Blain <david.blain@infrabel.be>
niklasr22
pushed a commit
to niklasr22/airflow
that referenced
this pull request
Feb 8, 2025
…in dialects of common sql provider (apache#45640) * refactor: Make sure reserved words in column names are all escaped in the generate_replace_sql method of MSSQLDialect --------- Co-authored-by: David Blain <david.blain@infrabel.be>
ambika-garg
pushed a commit
to ambika-garg/airflow
that referenced
this pull request
Feb 17, 2025
…in dialects of common sql provider (apache#45640) * refactor: Make sure reserved words in column names are all escaped in the generate_replace_sql method of MSSQLDialect --------- Co-authored-by: David Blain <david.blain@infrabel.be>
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.
Not only fixes escaping of reserved words or special characters as column names but also fixes un-escaping of column names or table names.
Unit tests have been added accordingly.
Also allow "escape_word_format", "insert_statement_format" and "replace_statement_format" to be defined in extra of connection, this is handy when using Jdbc or Odbc based hooks.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.