Merge pull request #679 from CartoDB/bug/ch140184/gloval-seven-admin-batch-query-fallback-templates
[ch140184] Update documentation about fallback templates
This commit is contained in:
commit
2c5dce2082
@ -449,7 +449,7 @@ If a query of a job fails (and onerror fallbacks for that query and job are defi
|
||||
|
||||
#### Templates
|
||||
|
||||
Batch Queries provide a simple way to get the error message and the job identifier to be used in your fallbacks, by using the following templates:
|
||||
Batch Queries provide a simple way to get the error message and the job identifier to be used in your fallbacks defined at the query level, by using the following templates:
|
||||
|
||||
- `<%= error_message %>`: will be replaced by the error message raised by the database.
|
||||
- `<%= job_id %>`: will be replaced by the job identifier that Batch Queries provides.
|
||||
@ -460,15 +460,13 @@ This is helpful when you want to save error messages into a table:
|
||||
curl -X POST -H "Content-Type: application/json" -d '{
|
||||
"query": {
|
||||
"query": [{
|
||||
"query": "UPDATE wrong_table SET price = '$100.00' WHERE company = 'CARTO'"
|
||||
}],
|
||||
"onerror": "INSERT INTO errors_log (job_id, error_message, date) VALUES ('<%= job_id %>', '<%= error_message %>', NOW())"
|
||||
"query": "UPDATE wrong_table SET price = '$100.00' WHERE company = 'CARTO'",
|
||||
"onerror": "INSERT INTO errors_log (job_id, error_message, date) VALUES ('<%= job_id %>', '<%= error_message %>', NOW())"
|
||||
}]
|
||||
}
|
||||
}' "https://{username}.carto.com/api/v2/sql/job"
|
||||
```
|
||||
|
||||
More templates are coming soon.
|
||||
|
||||
### Fetching Job Results
|
||||
|
||||
In some scenarios, you may need to fetch the output of a job. If that is the case, wrap the query with `SELECT * INTO`, or `CREATE TABLE AS`. The output is stored in a new table in your database. For example, if using the query `SELECT * FROM airports`:
|
||||
|
Loading…
Reference in New Issue
Block a user