-
Notifications
You must be signed in to change notification settings - Fork 595
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
bug: Oracle Table alias #9179
Comments
Hi @Baazion -- thanks for reporting this! Can you tell us which version of Oracle you are running against? We only have a Docker image running 23.4 and table aliasing works as expected there -- I'm not sure which version this was added in? |
|
Ok, well, 19c is a LTS release and they promise support for another 2 years, so we can try to remove keyword that's causing the syntax error. Thanks, @Baazion ! |
This may need to be reported upstream to SQLGlot, and hopefully in the meantime there's a SQLGlot compiler flag we can use to set the aliasing style. |
Hmm, looks like [nav] In [3]: expr = sg.parse_one(
...: '''SELECT
...: COUNT(*) AS "CountStar()"
...: FROM (
...: SELECT
...: "t0"."sst_nr"
...: FROM "SOME_TABLE" AS "t0"
...: ) AS "t1"''',
...: read="oracle",
...: )
[ins] In [4]: expr.sql(dialect="oracle")
Out[4]: 'SELECT COUNT(*) AS "CountStar()" FROM (SELECT "t0"."sst_nr" FROM "SOME_TABLE" "t0") "t1"' |
Seems like we're potentially misusing
|
check out the table arg in alias_ |
Hey @Baazion -- I've been digging into this -- can you clarify how you are running the Oracle query? Are you generating the SQL and then executing it manually? Or are you hitting this error when using |
executed code (slightly sanitised):
output:
Executing with DuckDB-Conn returns a count. |
Thanks @Baazion -- I'm still having trouble reproducing this locally. Can you try upgrading Then, if that doesn't do it and you're game, you can try installing an ibis prerelease, which has a few fixes which may have helped with this, by running python -m pip install -U --pre 'ibis-framework[oracle]' |
Ran this with: but got the same Error |
Hello, i'm seeing the same issue, and I'm also using oracle 19. I get an error when running:
Full stack trace:
The query:
Is there any temporary workaround available? |
Thanks for the heads up @balintpto -- I have Oracle 18 in a docker image now and I can reproduce some of the failures, hopefully we can get some fixes in soon. I don't think there is an available workaround at the moment. |
Just following up here -- I believe all of the issues with Oracle < 23c stem from the fact that we (and sqlglot) assume that there are boolean datatypes available. There are definitely NOT boolean datatypes available before version 23. I'm trying to scope out how we can rewrite all of our booleans into case statements. |
I don't think the |
Ok, I just read through the reports here in more detail and this issue is mixing up two things that are unrelated to each other. There are two issues, one of which isn't reproducible.
Closing this issue as wontfix due to the lack of reproducibility. |
xref: #9378 |
I have a branch fixing some of this. Certainly @balintpto 's issue is from our use of |
What happened?
When Selecting on Oracle query gets parsed with AS for Table-Alias, which is not supported in Oracle
What version of ibis are you using?
9.0.0
What backend(s) are you using, if any?
Oracle
Relevant log output
Code of Conduct
The text was updated successfully, but these errors were encountered: