Setting engine parameters when using REST API to run queries

There are a number of different parameters that can specify how an engine should process a query. Generally, the default values are appropriate and there is no need to override them. However, especially on an ingest process, there are times it is necessary. For example, you might need the exact COUNT(DISTINCT) rather than the approximation.

SET firebolt_optimization_enable_exact_count_distinct = 1;

SET commands cannot be sent as standalone SQL statements in the REST API. For example, this returns the error syntax error, unexpected SET

curl --location --request POST 'https://fb-test-general-purpose.firebolt.us-east-1.app.firebolt.io?database=fb_test' --header "Authorization: Bearer $BEARER" --data-binary "SET firebolt_optimization_enable_exact_count_distinct = 1;"

In an API call, engine parameters are specified in the URL. This would work for the above example:

curl --location --request POST 'https://fb-test-general-purpose.firebolt.us-east-1.app.firebolt.io?database=fb_test&firebolt_optimization_enable_exact_count_distinct=1' --header "Authorization: Bearer $BEARER" --data-binary "SELECT COUNT(DISTINCT xxx)..."

The settings will apply only to the queries being executed, so another API call would also have to specify the parameters in the URL, if needed.