If a schema has an invalid structure, the resulting errors are a bit confusing. E.g. if the "tables" definition is missing, the resulting error looks like this:
Traceback (most recent call last):
File "/home/henning/.local/share/virtualenvs/postgresql-anonymizer-AUSqld0C/bin/pganonymize", line 11, in <module>
load_entry_point('pganonymize', 'console_scripts', 'pganonymize')()
File "/home/henning/Projekte/postgresql-anonymizer/pganonymizer/cli.py", line 32, in main
truncate_tables(connection, schema.get('truncate', []))
AttributeError: 'list' object has no attribute 'get'
It would ne nice to have a validation method that checks for the basic structure of the YAML file:
The tables keyword
fields at the table level
A provider at the field level, with at least a name
...
Instead of writing own methods for the validation it could be possible to use general Python based YAML validation libraries, e.g.:
If a schema has an invalid structure, the resulting errors are a bit confusing. E.g. if the "tables" definition is missing, the resulting error looks like this:
It would ne nice to have a validation method that checks for the basic structure of the YAML file:
tables
keywordfields
at the table levelprovider
at the field level, with at least aname
Instead of writing own methods for the validation it could be possible to use general Python based YAML validation libraries, e.g.: