Closed janmeier closed 3 years ago
Hi Jan!
Thanks for sending this in. This is actually a known issue with the current implementation of condenser, thought not quite as described — allow me to explain.
When you select a direct target, such as Meals, the current algorithm does one pass "upstream", meaning following foreign (parent) keys that point to Meals (in this case, MealFood and MealI18n), and any grandparents etc until you reach the "root tables", i.e. tables with no keys pointing to them. In this case, MealFood and MealI18n are the tables at the top.
From there, we make a downstream pass all the way down to the "leaf tables", i.e. tables that don't point to anything else. In this case, from MealFood and MealI18n, we go back down to Meal and Food, and then we call it a day. This is a referentially intact subset. Notably though, we never go back upstream! This means when we hit Food (which is first hit on the downstream pass), we don't go back upstream to grab FoodI18n. The intent was for us to minimize the amount of data collected to make a good subset — there's a wide variety of opinions of what makes a good subset.
That being said, we've actually written a new algorithm for subsetting traversal, and we're currently working on adding it to the core Tonic product. It will in fact hit MealI18n, and it ensures every related table will be subset.
We're not sure if we'll be adding this to condenser any time soon, but hopefully this context is helpful! I heard you spoke with Jake recently, happy to help where we can.
Hi Johnny
Thanks for the detailed explanation. I did take a brief look at the description of the algorithm, but your explanation makes it a lot clearer
Maybe I'm just misunderstanding what condenser is able to do :)
I have this schema - of course much more complex in reality, but this shows the problem I'm facing:
When dumping meals, I expect to get all the food items in the meal, and their i18ns.
MealI18n
is dumped correctly, butFoodI18n
is not.Create tables
Config
Console output
I thought maybe the problem was, that a primary key references another primary key, but I added
food_id
toFoodI18n
, but that still has the same problem