SQL over REST: Difference between revisions
Jump to navigation
Jump to search
(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...") |
No edit summary |
||
Line 12: | Line 12: | ||
{"a": 2, "sum_b": 6} |
{"a": 2, "sum_b": 6} |
||
{"a": 6, "sum_b": null} |
{"a": 6, "sum_b": null} |
||
+ | |||
+ | == Custom REST interfaces directly in MemCP == |
||
+ | To create your own custom REST endpoints, consider reading about [[In-Database WebApps]] |
Revision as of 09:49, 19 May 2024
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}
Custom REST interfaces directly in MemCP
To create your own custom REST endpoints, consider reading about In-Database WebApps