sql_query
Purpose
sql_query extracts the SQL statement of a Postgres, MySQL or SQL Server request: a simple query or batch, or the statement behind a prepare, describe, bind, execute or RPC, such as the statement of an sp_executesql.
Usage
"extractor": {
"type": "sql_query"
}
It takes no configuration. It applies to requests only.
Pair it with the SQL signature transforms, such as sql_fingerprint or sql_key_params, to tune how mocks match. Those transforms leave the statement unchanged. Any other transform that changes the extracted text rewrites the statement itself.
Example
A request for SELECT name FROM users WHERE id = $1, sent as a prepared statement, extracts the text SELECT name FROM users WHERE id = $1 from every message of that statement.
Related
- Matching SQL mocks explains how SQL mocks match and how the SQL transforms change that.