You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
insert into tab3 (with tab1 as (SELECT * FROM tab2) SELECT * FROM tab1);
The problem seems to be that DmlInsertExtractor does not handle bracketed segments.
I would think that the fix would be something like adding
if segment.type == "bracketed":
holder |=self.extract(
segment,
AnalyzerContext(prev_cte=holder.cte, prev_write=holder.write),
)
to DmlInsertExtractor.extract but that doesn't work because the segments returned on the next iteration don't contain "with_compound_statement" but instead the individual parts [<KeywordSegment: ([L: 1, P: 19]) 'with'>, <CTEDefinitionSegment: ([L: 1, P: 24])>,<SelectStatementSegment: ([L: 1, P: 53])>].
I would love to hear any other suggestions and would be happy to open a PR myself with some tests if we can find a solution
The text was updated successfully, but these errors were encountered:
This is definitely a bug and I think you're very close to it.
Here's what my instinct tells me, not guarantee it will work. But you can try after going into "bracketed", based on it starts with CTE or not, you can call DmlCteExtractor or DmlSelectExtractor. Look forward to your PR.
Hi!
sqllineage fails to parse the following query:
The problem seems to be that
DmlInsertExtractor
does not handle bracketed segments.I would think that the fix would be something like adding
to
DmlInsertExtractor.extract
but that doesn't work because the segments returned on the next iteration don't contain "with_compound_statement" but instead the individual parts[<KeywordSegment: ([L: 1, P: 19]) 'with'>, <CTEDefinitionSegment: ([L: 1, P: 24])>,<SelectStatementSegment: ([L: 1, P: 53])>]
.I would love to hear any other suggestions and would be happy to open a PR myself with some tests if we can find a solution
The text was updated successfully, but these errors were encountered: