18F / rdbms-subsetter

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

Option to use a certain set of records #4

Open afeld opened 9 years ago

afeld commented 9 years ago

At a previous company, we had a script to replicate a user's account locally, so we could test how a user with a lot of projects might experience the site, or to troubleshoot why a certain combination of settings caused a certain problem. Not sure the easiest way to generically support that syntax-wise, but would be useful.

catherinedevlin commented 9 years ago

There is a --force keyword that will force the subset to include specific records - so that

rdbms-subsetter --force=user:1234

ensures that the record from the user table with primary key 1234 will be included in the test db. (And you can use --force as many times as you need to.) Does that meet your need?

chrisvoo commented 9 years ago

Nice works. It could be very usefull to select records inside a time interval or above or below a particular date, because it's very frequent to have automatic timestamp on row creation.

chimeno commented 7 years ago

First, thanks for the work on this project. I'm in the same case as @chrisvoo , I would like to select rows based on the timestamp. (i.e. for this table, get the last rows two months before today) Although making a select first to get the primary keys is factible, it could be great to have an option for timestamp, or, unless, having a way we can force in the way:

rdbms-subsetter --force:id:>=120000