rajgumma
rajgumma

Reputation: 21

How do I use prepared statements in Athena with boto3?

I'm trying to use the prepared statements added in athena engine version 2 using boto3. I see api docs for CreatePreparedStatement but nothing for executing the prepared statement https://docs.aws.amazon.com/athena/latest/APIReference/API_CreatePreparedStatement.html https://docs.aws.amazon.com/athena/latest/ug/querying-with-prepared-statements.html

Upvotes: 2

Views: 2192

Answers (2)

Marco Pérez
Marco Pérez

Reputation: 61

You just submit a SQL statement with Client.start_query_execution

Execute prepared_statement_name 'param1','param2', etc...

Upvotes: 1

Robert Kossendey
Robert Kossendey

Reputation: 7028

The boto3 Athena documentation does not specify an API to execute a prepared statement directly currently. A possible workaround would be to get the PreparedStatement object by calling get_prepared_statement(), extracting the query statement from the object, and run start_query_execution() with it.

Upvotes: 2

Related Questions