pg_sample icon indicating copy to clipboard operation
pg_sample copied to clipboard

Is there a way to export a sample by a table row?

Open motishaku opened this issue 3 years ago • 3 comments

hey, as the title asks, is there a way to export a sample of the db based on the relationships and the data from a single table? example: start from table A where the query given is A.id=1, go through all the tables foreign keys, and export the relavent data?

thanks in advance!

motishaku avatar Feb 12 '23 11:02 motishaku

Interesting. I don't think there is currently, sorry. I think you'd need to add --limit= rules for every table's FK where it -> a.id=1.

mla avatar Feb 12 '23 19:02 mla

Thanks, but i have over 200 tables. Do you plan by chance to add it one day? I would, but i never touched Perl, if not, i might create a rust version tho if fine by you

motishaku avatar Feb 12 '23 19:02 motishaku

I'm open to adding that. Need to think about how it would be expressed. I'm a bit swamped currently so prob wouldn't be fast regardless. A rust version would be cool.

mla avatar Feb 12 '23 19:02 mla