Skip to content

Get Non CTE expressions #1795

Closed Answered by georgesittas
vedas2 asked this question in Q&A
Jun 17, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

But If I have a query such as select a,b from table, is there a way to resolve table references?

Yes, you need to run the query through the optimizer and it'll resolve each column reference, qualifying it accordingly.

Is there any way to get the opposite? i.e non-CTEs only?

I'm not sure what "non-CTEs" means. If you don't want the CTEs of the query you can pop the "with" arg of each exp.Select expression in the AST of interest. Note that this will mutate the AST, so consider copying it first if you don't want that (or just use the transform method, since it automatically copies the input expression before transforming it).

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@vedas2
Comment options

@georgesittas
Comment options

@vedas2
Comment options

Answer selected by vedas2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants