Commit 234198a
feat(exasol): transpile USE/OPEN SCHEMA and SHOW TABLES to system-table 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>1 parent 8e4386d commit 234198a
3 files changed
Lines changed: 68 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
890 | 890 | | |
891 | 891 | | |
892 | 892 | | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
893 | 918 | | |
894 | 919 | | |
895 | 920 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
130 | 136 | | |
131 | 137 | | |
132 | 138 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
954 | 954 | | |
955 | 955 | | |
956 | 956 | | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
0 commit comments