Skip to content

Why am I unable to qualify this despite providing the schema? #3207

Closed Answered by georgesittas
rorynormaness asked this question in Q&A
Discussion options

You must be logged in to vote

I do not understand why it is being formatted as a nested string

In reality this is basically "metric2", but the error reporting code looks something like f"... '{column}' ...", making it seem like this is a string. The intention is to delimit the name so it's separated from the rest of the text and it's clear what's not resolved.

Question 1: Is there a reason for this/is it expected?

Yes, it's expected. The optimizer can't possibly disambiguate the metric2 reference without additional information.

Question 2: What am I doing wrong here?

You're not nesting your schema properly. This is how it needs to be changed:

from sqlglot import parse_one
from sqlglot.optimizer.qualify import qu…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by georgesittas
Comment options

You must be logged in to vote
1 reply
@georgesittas
Comment options

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