feat(exasol): transpile USE/OPEN SCHEMA and SHOW TABLES to system-table query#7538
Merged
georgesittas merged 4 commits intotobymao:mainfrom Apr 23, 2026
Merged
Conversation
…le query Exasol uses `OPEN SCHEMA <name>` where other dialects use `USE <name>`, and has no native `SHOW TABLES` statement — the equivalent is a SELECT on `SYS.EXA_ALL_TABLES`. Previously both statements produced invalid Exasol output (parse error or empty string). Changes: * Add `use_sql` in ExasolGenerator that emits `OPEN SCHEMA <this>` for the default `USE schema` form. For other kinds (e.g. `USE ROLE admin`, `USE WAREHOUSE wh`), emit an unsupported warning and fall back to the base `USE` generator rather than silently rewriting them as schema switches. * Add parser support in ExasolParser for `OPEN SCHEMA <id>` so it round- trips as an `exp.Use` node. * Add `show_sql` in ExasolGenerator that rewrites `SHOW TABLES [FROM db]` to `SELECT TABLE_NAME FROM SYS.EXA_ALL_TABLES WHERE TABLE_SCHEMA = ...`, using the provided schema (uppercased to match Exasol metadata) or `CURRENT_SCHEMA` when absent. Other SHOW kinds fall through to the base generator (which marks them unsupported).
georgesittas
approved these changes
Apr 22, 2026
Collaborator
georgesittas
left a comment
There was a problem hiding this comment.
Thanks! Can you please rebase off of main and resolve conflicts?
georgesittas
approved these changes
Apr 23, 2026
georgesittas
added a commit
that referenced
this pull request
Apr 23, 2026
…le query (#7538) * feat(exasol): transpile USE/OPEN SCHEMA and SHOW TABLES to system-table query Exasol uses `OPEN SCHEMA <name>` where other dialects use `USE <name>`, and has no native `SHOW TABLES` statement — the equivalent is a SELECT on `SYS.EXA_ALL_TABLES`. Previously both statements produced invalid Exasol output (parse error or empty string). Changes: * Add `use_sql` in ExasolGenerator that emits `OPEN SCHEMA <this>` for the default `USE schema` form. For other kinds (e.g. `USE ROLE admin`, `USE WAREHOUSE wh`), emit an unsupported warning and fall back to the base `USE` generator rather than silently rewriting them as schema switches. * Add parser support in ExasolParser for `OPEN SCHEMA <id>` so it round- trips as an `exp.Use` node. * Add `show_sql` in ExasolGenerator that rewrites `SHOW TABLES [FROM db]` to `SELECT TABLE_NAME FROM SYS.EXA_ALL_TABLES WHERE TABLE_SCHEMA = ...`, using the provided schema (uppercased to match Exasol metadata) or `CURRENT_SCHEMA` when absent. Other SHOW kinds fall through to the base generator (which marks them unsupported). * Update sqlglot/parsers/exasol.py * Update sqlglot/parsers/exasol.py --------- Co-authored-by: Jo <46752250+georgesittas@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related Exasol statement-transpilation features:
USE <schema>↔OPEN SCHEMA <schema>— Exasol usesOPEN SCHEMAwhere other dialects useUSE. Before this PR, parsingOPEN SCHEMA testraised a ParseError, and transpilingUSE testfrom MySQL produced a literalUSE testwhich Exasol rejects.SHOW TABLES [FROM <schema>]→ SELECT onSYS.EXA_ALL_TABLES— Exasol has no native SHOW TABLES. Before this PR the base generator emitted an empty string, leaving callers with no query to run.Before
After
Implementation notes
Test plan