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

PROD-2083: fix for mysql reserved word escaping #5072

Merged

Conversation

thingscouldbeworse
Copy link
Contributor

@thingscouldbeworse thingscouldbeworse commented Jul 9, 2024

Closes # PROD-2083

Description Of Changes

Escapes table names for mysql/postgresql, mysql in backticks and postgresql in double quotes. Prevents errors on collections with tables named with reserved keywords.

Code Changes

add a QueryConfig for mysql and postgresql which uses backticks or double quotes depending on which dialect

Steps to Confirm

  • run postgresql/mysql integration tests. A Lead table has been added to the mysql

Pre-Merge Checklist

  • All CI Pipelines Succeeded
  • Documentation:
    • documentation complete, PR opened in fidesdocs
    • documentation issue created in fidesdocs
    • if there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
  • Issue Requirements are Met
  • Relevant Follow-Up Issues Created
  • Update CHANGELOG.md
  • For API changes, the Postman collection has been updated
  • If there are any database migrations:
    • Ensure that your downrev is up to date with the latest revision on main
    • Ensure that your downgrade() migration is correct and works
      • If a downgrade migration is not possible for this change, please call this out in the PR description!

Copy link

vercel bot commented Jul 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Jul 11, 2024 5:36pm

Copy link

cypress bot commented Jul 9, 2024

Passing run #8850 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

Merge 30acfda into c94b447...
Project: fides Commit: 67128e0cf5 ℹ️
Status: Passed Duration: 00:35 💡
Started: Jul 11, 2024 5:46 PM Ended: Jul 11, 2024 5:47 PM

Review all test suite changes for PR #5072 ↗︎

@@ -364,7 +364,7 @@ def get_formatted_query_string(
clauses: List[str],
) -> str:
"""Returns an SQL query string."""
return f"SELECT {field_list} FROM {self.node.collection.name} WHERE {' OR '.join(clauses)}"
return f"SELECT {field_list} FROM `{self.node.collection.name}` WHERE {' OR '.join(clauses)}"
Copy link
Contributor

Choose a reason for hiding this comment

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

early drive-by review - i think you found the right spot for this! 🎊

@thingscouldbeworse thingscouldbeworse changed the title PROD-2083: fixtures for mysql reserved word escaping PROD-2083: fix for mysql reserved word escaping Jul 10, 2024
Copy link

codecov bot commented Jul 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.42%. Comparing base (c94b447) to head (30acfda).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5072   +/-   ##
=======================================
  Coverage   86.41%   86.42%           
=======================================
  Files         356      356           
  Lines       22171    22181   +10     
  Branches     2913     2913           
=======================================
+ Hits        19159    19169   +10     
  Misses       2497     2497           
  Partials      515      515           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@erosselli erosselli left a comment

Choose a reason for hiding this comment

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

Looks good! I think you're missing adding a Changelog entry 😄 and also filling out the PR description

@thingscouldbeworse thingscouldbeworse merged commit ba5a494 into main Jul 11, 2024
45 checks passed
@thingscouldbeworse thingscouldbeworse deleted the PROD-2083_fixtures-for-mysql-reserved-word-escaping branch July 11, 2024 18:07
Copy link

cypress bot commented Jul 11, 2024

Passing run #8851 ↗︎

0 4 0 0 Flakiness 0
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.

Details:

PROD-2083: fix for mysql reserved word escaping (#5072)
Project: fides Commit: ba5a49459e
Status: Passed Duration: 00:36 💡
Started: Jul 11, 2024 6:18 PM Ended: Jul 11, 2024 6:19 PM

Review all test suite changes for PR #5072 ↗︎

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants