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

Better schema validation #6

Open
hkage opened this issue Jan 3, 2020 · 0 comments
Open

Better schema validation #6

hkage opened this issue Jan 3, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@hkage
Copy link
Contributor

hkage commented Jan 3, 2020

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.:

@hkage hkage added the enhancement New feature or request label Jan 3, 2020
@hkage hkage added this to the 0.3.0 milestone Jan 3, 2020
@hkage hkage modified the milestones: 0.3.0, 0.4.0 Feb 11, 2020
@hkage hkage removed this from the 0.4.0 milestone May 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant