You can, but you have to worry about how your params will render. In this case you are passing the array and directly rendering it in the SQL statement. This will print [1, 2, 3]
in the SQL statement, which is of course not valid SQL.
Airflow uses Jinja to render the templates. In order to get a correct SQL statement you can use for loops in Jinja to render the params. Airflow also supports adding your own functions to use in Jinja. This means you need to create an Airflow plugin. For example you could add the following macro:
def render_list_sql(list):
return ', '.join(list)
If you have this properly imported as a plugin your sql template will turn into the following:
Select hotel_name from hoteldetails where id in ({{ macros.render_list_sql(params.hotel_ids) }});