Restrict queries to specific Amazon Athena database using jdbc url

Viewed 1412

Is it possible to restrict queries to a certain Amazon Athena database, so that queries are run only against that database?

I imagine something like

jdbc:awsathena://athena.us-east-1.amazonaws.com:443/databasename

, so that queries like

SELECT * FROM exampletable

are possible. Instead of

SELECT * FROM databasename.exampletable

Grateful for any hints.

3 Answers

You can specify a Schema Property in the jdbc url as follows ;

jdbc:awsathena://athena.[Region].amazonaws.com:443;User=[AccessKey];Password=[SecretKey];S3OutputLocation=[Output];Schema=[databasename];

then you can perform queries without the database name as follows;

SELECT * FROM exampletable;
Related