Use query parameters to provide dynamic values in SQL queries - Amazon SageMaker AI
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use query parameters to provide dynamic values in SQL queries

Query parameters can be used to provide dynamic values in SQL queries.

In the following example, we pass a query parameter to the WHERE clause of the query.

# How to use '--query-parameters' with ATHENA as a data store %%sm_sql --metastore-id athena-connection-name --metastore-type GLUE_CONNECTION --query-parameters '{"parameters":{"name_var": "John Smith"}}' SELECT * FROM my_db.my_schema.my_table WHERE name = (%(name_var)s);