-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(oracle): port to sqlglot #8020
refactor(oracle): port to sqlglot #8020
Conversation
c9b34ba
to
e98fc64
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally speaking looks great 👌🏻
Just a few questions.
I will look into the impala/druid failures since they seem to be consistent (but are passing on upstream/the-epic-split
)
if isinstance(node, sg.exp.Table): | ||
return sg.table(node.name, quoted=True) | ||
elif isinstance(node, sg.exp.Column): | ||
return sg.column(col=node.name, quoted=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oooh, I hadn't really thought about this but I suspect we should probably apply this transform in general to backends whose quoted
value is True
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Anyway, follow-up fodder.
# artificially locked tables | ||
cursor.close() | ||
raise | ||
df = OraclePandasData.convert_table(df, schema) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have this method in many of the backends. Nothing to do here except note for a follow up to perhaps generalize a bit.
36ee296
to
dcef0c4
Compare
def _datatype_sql(self: Oracle.Generator, expression: sge.DataType) -> str: | ||
# Use this to handle correctly formatting timestamp precision | ||
# e.g. TIMESTAMP (scale) WITH TIME ZONE vs. TIMESTAMP WITH TIME ZONE(scale) | ||
if expression.is_type("timestamptz"): | ||
for exp in expression.expressions: | ||
if isinstance(exp, sge.DataTypeParam): | ||
return f"TIMESTAMP ({self.sql(exp, 'this')}) WITH TIME ZONE" | ||
return "TIMESTAMP WITH TIME ZONE" | ||
return self.datatype_sql(expression) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if there's a better way to do this, but the regular mapping in Oracle.Generator.TYPE_MAPPING
didn't expose the scale parameter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At some point we should upstream the bug report to sqlglot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0882028
to
65eb3ca
Compare
Ok, I have this down to 3 failing tests locally. I've been staring at it for long enough that I'm not going to get anywhere else today. I'll pick it back up on Monday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the tests eventually pass, this LGTM!
Epic!
In ibis/backends/tests/error.py we define the fallback exception types as `None` if they cannot be imported (because the parent package isn't installed). This can lead to passing a tuple of possible exceptions that looks like ``` raises=(ImpalaHiveServer2Error, None, OracleDatabaseError) ``` If this gets passed without filteing, then you can end up with a gnarly internal pytest error. To avoid this, we filter out any `None` we find in `raises` while handling the custom pytest markers.
NICE |
No description provided.