kovihq / sqltools-athena-driver

AWS Athena Driver for VSCode Plugin SQLTools
MIT License
5 stars 11 forks source link

Show table records doesn't work if the schema isn't default #23

Open VDFaller opened 2 years ago

VDFaller commented 2 years ago

How to recreate

Try to show table records for any non-default schema table

Error message

If I try to select AwsDataCatalog.my_schema.my_table I get

[1660748811912] ERROR (ext): ERROR: Error while showing table records SYNTAX_ERROR: line 2:6: Table awsdatacatalog.default.my_table does not exist, {"code":-1,"data":{"driver":"driver.athena","driverOptions":{}}}

I feel like this used to work, not sure. I tried back to 0.0.2 and maybe I'm just dumb.

JohniMichels commented 1 year ago

Can you please share the schema from athena? Are there any special chars? Sample looking in to a non default table in schema

VDFaller commented 1 year ago

It's not even trying to go to the schema it literally just tries to the default schema.

It tries to go to awsdatacatalog.default.my_table instead of awsdatacatalog.my_schema.my_table

To be clear this is when I right click and click show table records.

image

rumbin commented 1 year ago

Same issue here; please let me know if I can provide any debug info. Our schemas are nicely named (lower snake_case). The issue is just that the query for the table preview does not use a fully-qualified table name.

rumbin commented 1 year ago

Example: This is what is generated by SQLTools for previewing (Athena console screenshot of the query history):

image

This is Athena's error message:

image

This is SQLLab's error:

ERROR (ext): ERROR: Error while showing table records SYNTAX_ERROR: line 2:6: Table awsdatacatalog.default.incidents does not exist, {"code":-1,"data":{"driver":"driver.athena","driverOptions":{}}}
    ns: "error-handler"

And this is what the query should have looked like:

image