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

Ignore certain relations #17

Closed
janmeier opened this issue Nov 18, 2020 · 1 comment
Closed

Ignore certain relations #17

janmeier opened this issue Nov 18, 2020 · 1 comment

Comments

@janmeier
Copy link

Hi there 👋

Thanks for making this tool open source, it seems to work really well!

However: Say I an entity table, with a createdBy column, referencing account. I would like to grab a subset of entity, so i put the following in my config

"initial_targets": [
        {
            "table": "public.entity",
            "percent": 5
        }
    ],

However, I don't want to dump accounts, since they contain PII so I add

"excluded_tables": [ "public.account" ]

However, now the inserts into entity fail, because entity.createdBy references an account which does not exist in my dump.

I am fine with createdBy being set to null on all entities, but I'm not sure how / whether that's possible with this tool

@theaeolianmachine
Copy link
Contributor

Hey Jan, off the top of my head, the best way to handle this is likely with the dependency_breaks config. Normally this would be for breaking a cycle, but what it does is it sets the column entirely to NULL in order to "break the cycle". I think this should do the trick here, but have not looked into the behavior when you're using this outside of a cycle. Of course, the column must be nullable.

Otherwise, is this failing during the subset run? If it's not, you can always add a post script with post_subset_sql. If neither of these work, it'd likely take a code change to enable this behavior correctly for excluded tables. It's notable that with Tonic you could just include the table with it masked, ideally giving more utility for the output database by having the accounts table be present in a masked form.

Hope this helps!

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

No branches or pull requests

2 participants