Query for get data by stream¶
The body of query for get data, with the answer of get all by stream : the rows go out as the database sends them.
In short
POST /api/schema/<user-path>/<instance>/<database>/<table>/query-stream- The body of the query API :
findis required. - The answer of get all by stream : read
successat the end. - Never cached. Pre hooks run, post hooks do not.
| Method | POST |
| URL | /api/schema/admin/mysql8/inventory/customers/query-stream |
| Body | { find, select, sort, skip, limit, deep, getTotalCount } |
| Query params | none |
| Answer | data : a list of rows, sent as they come |
| Databases | MongoDB, MySQL, MariaDB, PostgreSQL, SQL Server, Oracle, TiDB, Percona |
| Cached | no : a stream always reads the database |
| From code | g.sys.db.queryByStream |
| API id | SCHEMA_POST_QUERY_STREAM |
| Without a schema | /api/gen/admin/mysql8/inventory/customers/query-stream : below |
The call¶
Answer, written in bunches
{ "data": [ { "customer_id": 1, "first_name": "Bob" }, { "customer_id": 2, "first_name": "Alice" } ], "success": true, "statusCode": 200 }
- The keys and operators of the query API work here, find and join and
deeptoo. - An error after the first rows still closes the answer as JSON, with
"success": falseand the errors. - Everything else (hooks, columns, compression) is as on get all by stream.
From your code¶
Without a schema : /api/gen¶
Every table also answers this operation under /api/gen, with or without a schema :
| URL | /api/gen/admin/mysql8/inventory/customers/query-stream |
| API id | GEN_POST_QUERY_STREAM |
| From code | g.sys.db.gen.queryByStreamGen |
find matches the type you send. On MongoDB, a text that looks like an ObjectId is turned into one.
Headers and errors¶
This operation takes the request headers of every API. It answers the envelope, with the status codes and the messages of every API.
Related : All APIs · Table schema · Pre hooks · Post hooks · API group permission