SQL over REST

From MemCP
Revision as of 09:47, 19 May 2024 by Carli (talk | contribs) (Created page with "There are two methods to do SQL over REST: a) GET method: <code>curl <nowiki>http://root:admin@localhost:4321/sql/</nowiki>[SCHEMA]/[SQL_QUERY]</code> b) POST method: <code>curl -X POST -d '[SQL_QUERY]' <nowiki>http://root:admin@localhost:4321/sql/</nowiki>[SCHEMA]</code> == JSONL results == The result is a <code>jsonl</code> document containing the result lines: curl -X POST -d 'select a, sum(b) as sum_b from a group by a' <nowiki>http://root:admin@localhost:4321/sq...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

There are two methods to do SQL over REST:

a) GET method: curl http://root:admin@localhost:4321/sql/[SCHEMA]/[SQL_QUERY]

b) POST method: curl -X POST -d '[SQL_QUERY]' http://root:admin@localhost:4321/sql/[SCHEMA]

JSONL results

The result is a jsonl document containing the result lines:

curl -X POST -d 'select a, sum(b) as sum_b from a group by a' http://root:admin@localhost:4321/sql/test

returns

{"a": 1, "sum_b": 7}
{"a": 2, "sum_b": 6}
{"a": 6, "sum_b": null}