TonicAI / condenser

Condenser is a database subsetting tool
https://www.tonic.ai
MIT License
312 stars 48 forks source link

Self referential tables are not supported #12

Closed jasonjho closed 5 years ago

jasonjho commented 5 years ago

Seeing

ValueError: Circular dependency, public.orders depends on itself!

in cases where tables (e.g. orders) have rows with parent references of the same type.

acolombi commented 5 years ago

Hi Jason,

Yeah, if you have a circular dependency, you need to instruct Condenser to ignore the dependency. This is accomplished with the dependency_breaks part of the config. Judging by the error message I think you'll need to add the following dependency_breaks:

    "dependency_breaks": [
        {"fk_table": "public.orders", "target_table": "public.orders"},
    ],

When do this you're basically telling Condenser to ignore this foreign key for the purposes of subsetting.

I'll close this for now, as Condenser is working as intended. But happy to continue the discussion in this issue.