It would be great to allow calling custom code at various points.
My use case is that I want to add some related rows whenever a row is added, and I'd like to avoid maintaining a forked copy of rdms-subsetter.
It is perhaps possible to satisfy my needs by using the config option, but if I did that it would require creating a definition for each one of 30 tables (and have to remember to update that when a table is added / removed). I could accomplish what I need to do with a few lines of code if I can hook in at the right place.
It seems like these "hooks" could be useful:
row_will_be_added
row_was_added
extraction_will_start
extraction_complete
and maybe some others.
Perhaps it could work like this:
The command line would allow specifying a hooks module, e.g. --hooks-module=my.custom.module.
If a hooks module is specified, the available hook methods are assigned to variables in subsetter.py
subsetter.py calls out to the hooks, if they are defined, at the appropriate places in the code. For example:
if hooks.row_was_added:
hooks.row_was_added(source_db, source_row, target_db, target_table, prioritized)
It would be great to allow calling custom code at various points.
My use case is that I want to add some related rows whenever a row is added, and I'd like to avoid maintaining a forked copy of rdms-subsetter.
It is perhaps possible to satisfy my needs by using the
config
option, but if I did that it would require creating a definition for each one of 30 tables (and have to remember to update that when a table is added / removed). I could accomplish what I need to do with a few lines of code if I can hook in at the right place.It seems like these "hooks" could be useful:
and maybe some others.
Perhaps it could work like this:
--hooks-module=my.custom.module
.