rheinwerk-verlag / pganonymize

A commandline tool for anonymizing PostgreSQL databases
http://pganonymize.readthedocs.io/
Other
42 stars 26 forks source link

hotfix(): Removed error incase of no truncate section in schema. #13

Closed ray-man closed 3 years ago

ray-man commented 3 years ago

My schema didn't have any truncate section so it was throwing me an error as below.

Screenshot 2020-12-03 at 5 36 46 PM

SQL command TRUNCATE TABLE ; was being generated with no table names to truncate.

hkage commented 3 years ago

Hi, thank you for your pull request.

There are some test errors in the development branch that also fail in your branch. I will check that first so you can merge it with the development again. After that I will take a look into your changes.

Did you add the python-test.yml workflow file in this pull request on purpose? It seems to be identical with the current python_test.yml file.

Best regards, Henning

ray-man commented 3 years ago

Thanks, @hkage for responding to PR.

I observed the building failing so was willing to look into it but got distracted with other stuff so couldn't get my hands dirty over it and solely for this reason python-test.yml resides there but you may discard it or I'll remove it.

hkage commented 3 years ago

The change looks good to me. I will merge the pull request and make a new release.

In addition to your fix I would suggest to make a check if the truncate contains any elements before opening a cursor and writing a log message. Otherwise it looks a bit confusing in the shell with a more detailed verbosity:

INFO: Truncating tables ""

I will adjust the code in the development branch, right after mergin your PR.

Thanks again for your contribution.