-
Notifications
You must be signed in to change notification settings - Fork 32
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
feat: add support to specify tables in list of columns #13
Conversation
also fix bug where fixed word gets overridden with random faker word
Any comments @rap2hpoutre ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you (again) for your help and to keep this lib alive thanks to your work 🙏
Just before I approve this PR, I want to be sure /
is the "correct" character to specify tables names. In another (super similar) library I created for mongodb, I choose to separate the collection from fields with dots: https://github.com/rap2hpoutre/mongodb-anonymizer#specify-list-of-fields-to-anonymize
users.email,products.price
So in our case it could be just:
public.user.email,public.product.description
And for a more complicated case using faker it could be:
public.user.firstName:faker.name.firstName
I would eventually prefer using this syntax because:
/
could seems weird to users.
is more "classic" and feels like SQL.
is similar to what I implemented in this (copy/pasted) lib: https://github.com/rap2hpoutre/mongodb-anonymizer
What do you think?
I thought that dots would be allowed in column names, but I reviewed the postgresql docs and they are not allowed, so I support switching from / to . and will do the change. |
OK updated based on your comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉 Thank you, you can merge it! I will release it on NPM right after (in the meanwhile, I guess I will add semantic release in order to automate the release process that should not rely only on my will).
EDIT: I just added an issue here: #14
Let me look at issue #14 and add those. I have two more things I'd like to add - load the replacement list from a file, and send the output to stdout. Should I add that to this PR, or start a new one? |
I suggest we open one PR for each subject. I guess this PR is mergeable as-is then. Feel free to merge it now! (I can also merge it myself if you prefer!) |
# [0.5.0](v0.4.0...v0.5.0) (2022-03-13) ### Features * add support to specify tables in list of columns ([#13](#13)) ([bc6638d](bc6638d)) * new option to read replacements from a file ([#18](#18)) ([a7c6441](a7c6441)) * output can be stdout so you can pipe it to other commands ([#19](#19)) ([11e46ce](11e46ce)) * table name to extension functions ([#8](#8)) ([9f0a8f8](9f0a8f8))
Now you can replace columns in a specifiic table instead of all tables that have the same column name. You can also specify different replacements for the same column name in different table.
also fixed a bug where a static word replacement was overridden by faker.random.word.
Merry Christmas!