fix: allow dispatching items to nested tables when specified parent_table_name
equals resource.table_name
#2106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I am trying to dispatch items from one resource to different tables, but connect them via a
_dlt_parent_id
reference.Expected
Two tables.
my_table
:other_table
:however instead the test case in this PR yields an exception:
Where the error gets thrown, there is a comment:
dlt/dlt/common/schema/utils.py
Line 513 in eefe77b
:-D
And as you can see from the error message, the assertion is not quite right:
A few ideas:
parent_table_name
is ACTUALLY different from thetable_name
of the enclosing resource?My feeling is 2., but I am not 100% sure. The test passes with my proposed change.
You can run the test via:
There is a commented out chunk of code that does something similar actually and raises the same exception:
dlt/dlt/common/schema/utils.py
Lines 522 to 531 in eefe77b
On a side note, I did just notice that there is no
_dlt_parent_id
inmy_other_table
with this test case, it looks like this:unsure where to pass the hint to create the parent child relationship.