rwnx / pynonymizer

A universal tool for translating sensitive production database dumps into anonymized copies.
https://pypi.org/project/pynonymizer/
MIT License
103 stars 38 forks source link

fix: allow usage of postgresql keywords as columns #26

Closed babariviere closed 3 years ago

babariviere commented 3 years ago

Fix an issue when using fields that are PostgreSQL keywords.

For example, this query will fail:

tables:
  my_table:
    columns:
      from: uuid4 # this field is a keyword and will fail

This PR patch this issue by escaping SQL fields in UPDATE query.

rwnx commented 3 years ago

Hi!

This is a nice fix! I'll be happy to get this merged in. Do you think you can add an entry in the CHANGELOG.md file?

Also I'm not exactly sure on how to get this done for a fork but we need to run the tests for this! I'm 99% sure this will break the postgres tests for the query factory (since it's based on string matching). Any ideas?

Thanks! 😇

babariviere commented 3 years ago

Hi!

This is a nice fix! I'll be happy to get this merged in. Do you think you can add an entry in the CHANGELOG.md file?

Also I'm not exactly sure on how to get this done for a fork but we need to run the tests for this! I'm 99% sure this will break the postgres tests for the query factory (since it's based on string matching). Any ideas?

Thanks! 😇

Yes sorry, I should have been more careful about the tests. 😅 I have fixed it with my latest commit.

rwnx commented 3 years ago

Awesome. Thank you for your contribution! ✨ The postgres provider could do with some love.

I've verified the tests are working and I'll merge now. Changes will likely go with the next planned release v1.14.0, which I'll put together in the next few days.