Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR][CARTO] Add Batch API support #1

Open
AbelVM opened this issue Oct 11, 2017 · 0 comments
Open

[FR][CARTO] Add Batch API support #1

AbelVM opened this issue Oct 11, 2017 · 0 comments

Comments

@AbelVM
Copy link

AbelVM commented Oct 11, 2017

Maybe detecting a tag in the query, v.g. BATCH:, and the ;. Something like

BATCH:
CREATE TABLE world_airports AS SELECT a.cartodb_id, a.the_geom, a.the_geom_webmercator, a.name airport, b.name country FROM world_borders b JOIN airports a ON ST_Contains(b.the_geom, a.the_geom);
DROP TABLE airports;
ALTER TABLE world_airports RENAME TO airport;

Should be translated to this Batch API call

HEADERS: POST /api/v2/sql/job
BODY: {
  query: [
    "CREATE TABLE world_airports AS SELECT a.cartodb_id, a.the_geom, a.the_geom_webmercator, a.name airport, b.name country FROM world_borders b JOIN airports a ON ST_Contains(b.the_geom, a.the_geom)",
    "DROP TABLE airports",
    "ALTER TABLE world_airports RENAME TO airport"
  ]
}

And return the job IDs as a single field

As described in https://carto.com/docs/carto-engine/sql-api/batch-queries/#chaining-batch-queries

alrocar pushed a commit that referenced this issue May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant