-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix escaping of special characters or reserved words as column names in dialects of common sql provider #45640
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 escaping of special characters or reserved words as column names in dialects of common sql provider #45640
Conversation
… the generate_replace_sql method of MSSQLDialect
…scaped but also make sure any special character is escaped, not only dots or reserved words
|
@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
|
cc @potiuk any comments on this one? If not happy to merge it |
|
@dabla can you rebase and resolve conflicts? I will merge after |
just rebased and merged with main |
…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>
…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>
…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>
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.