18F / rdbms-subsetter

Generates a subset of a relational database that respects foreign key constraints
Creative Commons Zero v1.0 Universal
313 stars 30 forks source link

Allow specification of quasi-foreign keys in config file. #19

Closed jmcarp closed 9 years ago

jmcarp commented 9 years ago

This may be too much of an edge case to merge, but here goes. Some databases may have quasi-foreign key relations, where no foreign key constraint is declared, but a column in one table still refers to primary keys in another table. In that case, it's helpful to be able to manually specify a set of additional foreign key relationships that the subsetter should respect. This patch adds an optional command line argument called --config that can point to a JSON file. The constraints field of that file, if it exists, is inspected for additional quasi-foreign key relationships--example at https://github.com/jmcarp/openFEC/blob/feature/auto-subset/data/subset-config.json.