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

Athena driver #332

Closed
forbesmyester opened this issue May 26, 2022 · 6 comments
Closed

Athena driver #332

forbesmyester opened this issue May 26, 2022 · 6 comments

Comments

@forbesmyester
Copy link

Hi, thanks for usql, I really quite enjoy using it and is the only SQL tool that makes me think about leaving psql by choice (I also have to use SQLite and Athena).

On the Athena though, I am trying to connect via usql 'athena://____:____@athena.eu-west-2.amazonaws.com/dev-databasing?s3_staging_dir=s3%3A%2F%2Fmy-bucket-%2F' which is the best I've been able to figure out, but it's giving the error:

error: athena: sql: unknown driver "athena" (forgotten import?)

However if I do \drivers I get

$ usql
Pager usage is off.
Null display is "·".
Type "help" for help.

(not connected)=> \drivers
Available Drivers:
  athena [s3, aws]
  avatica [av, phoenix]
  bigquery [bq]
  --- SNIP ---

It could well be user error, but I'm a bit flumoxed... help would be appreciated.

@forbesmyester
Copy link
Author

$ usql --version
usql 0.10.0

@kenshaw
Copy link
Member

kenshaw commented May 26, 2022

@forbesmyester I just pushed a change (I have not tagged it, and am not planning on doing a release until I can verify the change works) that should fix this. I'm not sure if they changed the driver name, or if I never properly vetted this when I added it. Apologies. Over the weekend I should have time to verify this against an actual Athena instance. Please note that URLs for Athena will need to look something like this:

s3://myqueryresults?WGRemoteCreation=true&accessID=DummyAccessID&db=default&missingAsEmptyString=true&region=us-east-2&secretAccessKey=DummySecretAccessKey

(the driver that's being used here is decidedly non-idiomatic Go, and "requires" use of the driver's APIs to generate a DSN ... I'll look at this closer over the weekend)

I'd appreciate it if you could checkout usql from the latest source, build it (I'd suggest using the ./most.sh script) and see if you're able to connect to an Athena instance.

Thank you for bringing this to my attention, and I appreciate your understanding that it's difficult to track all the different drivers/databases.

@kenshaw
Copy link
Member

kenshaw commented Aug 26, 2022

@forbesmyester can you check if the latest version of usql fixes this issue? Thanks.

@forbesmyester
Copy link
Author

Hi @kenshaw

I have:

$ usql 's3://__S3_STAGING_DIR_NOT_URL_ENCODE_WITH_TRAILING_FORWARDSLASH_ALSO_NOT_ENCODED?WGRemoteCreation=true&accessID=__THE_ACCESS_KEY__&db=__DATABASE_NAME_PROBABLY_URLENCODED_&missingAsEmptyString=true&region=eu-west-2&secretAccessKey=__THE_SECRET_URLENCODED__'

Which does work / can query, though \d does not (not supported by awsathena driver).

$ usql --version
usql 0.12.13

@nineinchnick
Copy link
Member

Can you open another issue about implementing metadata introspection for Athena, so that the \d commands and completion would work?

Looks like the issue reported here is resolved and you could close this one.

@forbesmyester
Copy link
Author

Sure, new ticket opened - #375

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

3 participants