CartoDB-SQL-API/batch
2016-10-10 19:54:59 +02:00
..
leader Add distributed lock implementation with redis distlock 2016-10-10 19:51:11 +02:00
models DRY job final statuses 2016-10-10 12:09:13 +02:00
util Moved forever module 2016-05-18 11:55:58 +02:00
batch-logger.js Batch Queries: use path instead of stream to be able to reopen FD 2016-10-03 13:28:13 +02:00
batch.js Add dist lock to run all jobs by host in order 2016-10-10 19:54:59 +02:00
index.js Inject publisher 2016-10-10 19:47:50 +02:00
job_backend.js DRY job final statuses 2016-10-10 12:09:13 +02:00
job_canceller.js Fixes #293, set cancel status to a job that actually is no running but has running status. 2016-05-23 10:26:09 +02:00
job_publisher.js Uses redis-mpool for pubsub in Batch API 2016-07-07 14:14:46 +02:00
job_queue_pool.js Now Batch API broadcast to other APIs everytime that re-enqueues a multiple-query job 2016-06-29 18:29:53 +02:00
job_queue.js Now Batch API broadcast to other APIs everytime that re-enqueues a multiple-query job 2016-06-29 18:29:53 +02:00
job_runner.js Allow users to set max statement_timeout for their queries 2016-10-10 12:01:36 +02:00
job_service.js Remove .list() from job service 2016-08-30 18:51:51 +02:00
job_status.js Allow users to set max statement_timeout for their queries 2016-10-10 12:01:36 +02:00
job_subscriber.js Added callback to job subscriber to allow to batch service emit ready event 2016-07-22 13:47:14 +02:00
query_runner.js Timeout is passed into query runner 2016-10-10 12:00:54 +02:00
queue_seeker.js Refactored batch-api startup. Isolated code related to queue discovering, api much clear and concise. 2016-04-04 16:05:33 +02:00
README.md Add readme for batch queries feature 2016-10-06 12:27:38 +02:00
user_database_metadata_service.js Removed unused callback in before hook in test and added proper configuration from user database config 2016-01-14 14:08:34 +01:00

Batch Queries

This document describes the currently supported query types, and what they are missing in terms of features.

Job types

Simple

{
    "query": "update ..."
}

Does not support main fallback queries. Ideally it should support something like:

{
    "query": "update ...",
    "onsuccess": "select 'general success fallback'",
    "onerror": "select 'general error fallback'"
}

Multiple

{
    "query": [
        "update ...",
        "select ... into ..."
    ]
}

Does not support main fallback queries. Ideally it should support something like:

{
    "query": [
        "update ...",
        "select ... into ..."
    ],
    "onsuccess": "select 'general success fallback'",
    "onerror": "select 'general error fallback'"
}

Fallback

{
    "query": {
        "query": [
            {
                "query": "select 1",
                "onsuccess": "select 'success fallback query 1'",
                "onerror": "select 'error fallback query 1'"
            },
            {
                "query": "select 2",
                "onerror": "select 'error fallback query 2'"
            }
        ],
        "onsuccess": "select 'general success fallback'",
        "onerror": "select 'general error fallback'"
    }
}

It's weird to have two nested query attributes. Also, it's not possible to mix plain with fallback ones. Ideally it should support something like:

{
    "query": [
        {
            "query": "select 1",
            "onsuccess": "select 'success fallback query 1'",
            "onerror": "select 'error fallback query 1'"
        },
        "select 2"
    ],
    "onsuccess": "select 'general success fallback'",
    "onerror": "select 'general error fallback'"
    }
}

Where you don't need a nested query attribute, it's just an array as in Multiple job type, and you can mix objects and plain queries.