Skip to content
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

field filter issue when using default database to connect to #114

Open
juliansteger-sc opened this issue Oct 31, 2022 · 3 comments
Open

Comments

@juliansteger-sc
Copy link

We are using this Athena Adapter with following setting for Additional Athena connection string options:

Schema=my_custom_schema

Now when we set up a field filter like in

select * from mytable
where {{ column_name }}

the query fails with

[Simba][AthenaJDBC](100071) An error has been thrown from the AWS Athena client. COLUMN_NOT_FOUND: line 3:7: Column 'my_custom_schema.my_table.column_name' cannot be resolved [Execution ID: ...]

because prefixing the table by the database name doesn't work in where statements.

Not sure if this is a bug in this driver or a shortcoming of the jdbc driver.
Thanks

@dacort
Copy link
Owner

dacort commented Oct 31, 2022

I can repro this as well.

I looks like this is because the generated query doesn't use the proper schema name in the FROM statement. Not sure yet if this is in this driver or not, but likely. :)

Expected query:

SELECT * FROM "databasename"."tablename"
WHERE "column_name" = xx

Actual query:

SELECT * FROM tablename
WHERE "databasename"."tablename"."column_name" = xx

This also doesn't work even without the Shema setting.

A temporary workaround would be to update the SQL query to include the schema name, e.g. SELECT * FROM my_custom_schema.mytable.

@juliansteger-sc
Copy link
Author

@dacort to follow up on this - by driver we're talking about the underlying jdbc driver right? Then it would it make sense to open an AWS Support Ticket / feature request for this, right?
Or do you know if this is fixed in the native Athena integration in metabase 0.45?
Thanks

@dacort
Copy link
Owner

dacort commented Dec 19, 2022

@juliansteger-sc No, I did mean the Metabase Athena driver. I think I was trying to determine if the issue lay in my implementation of the SQL queries in the Metabase Athena driver or in one of the generic "jdbc" functions from Metabase that get called by this driver. I still don't know the answer and left this issue open because I was hoping to research it.

That said, feel free to try out 0.45 and see if it works. If not, I'd open an issue with Metabase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants