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

add a hook to validate the collection at the end of import_directory #81

Open
jpmckinney opened this issue May 18, 2014 · 3 comments
Open
Labels

Comments

@jpmckinney
Copy link
Member

In order to run uniqueness validations, all the data needs to be imported into the database. If import_directory can call a validation method (which can be a noop in BaseImporter) before returning, I can override that method to issue warnings if collection/table-level validations don't pass.

Right now, I need to run these validations from outside Pupa, which means I don't see the validation errors when I run pupa update while developing the scraper.

@jamesturk
Copy link
Member

this should be easy to add in general- where would your override live though?

@jpmckinney
Copy link
Member Author

I'd probably import the appropriate Importer class and override the validation method with my logic. I don't know common Python patterns for injecting code/behavior into an existing class, so there are likely better ways.

@jpmckinney
Copy link
Member Author

Are there any Python patterns for injecting code into, for example, PersonImporter's postimport?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants