Repository navigation
Add support for new /v2/query endoint - #1897
Conversation
|
Why not both?
|
Apart from
How would the new ones be named? As per the PR body, I'm not a fan of |
c491e42 to
398fd93
Compare
398fd93 to
37d5c0f
Compare
Docs Preview
Re-add the |
d07a7f6 to
8ae946b
Compare
8ae946b to
b9f4c21
Compare
This comment was marked as resolved.
This comment was marked as resolved.
3113be9 to
7a04236
Compare
This comment was marked as resolved.
This comment was marked as resolved.
|
LGTM, final AI pass. @cubic-dev-ai review. |
@alexmojaki I have started the AI code review. It will take a few minutes to complete. |
dbcf8de to
45f49f1
Compare
|
🥳 🎆 |
This switches the existing client to use the
/v2/queryendpoint, for all existing methods. A follow up PR can add support for NDJSON streaming.I went over a couple solutions to make the switch to the new endpoint. Here are some requirements to keep in mind:
min_timestampset when existing usage did not set any.The first solution would be to introduce new methods, leaving the existing ones unchanged (still targeting
/v1/query):query_json_v2()isn't ideal, because if/when we remove the old ones, we end up with thisv2naming in the method)./v2/queryresult structure (e.g. no_transform_fields_for_backwards_compatibility(), etc).The second solution is to adapt the existing methods, while still preserving backwards compatibility:
min_timestampis deprecated, and will be required in the future (internally, we use2020-01-01as amin_timestamp)._map_v2_result()). This remaps thecolumnsfield, and only renames the top leveldata->rows(so no concerns of memory/CPU usage client side, we're not iterating/recreating a list of all the rows)./v2/query's defaultlimitwhen from 100 to 1000, and we rely on the remote default here. I feel it is ok to potentially return more results; could this break existing usage? Anyone could be relying on the limit of 100 in some way?Imo 2 is the best option, so this is the one I implemented.
For the query stream method, I'm wondering if a utility to filter (in a type safe way?) message types would be useful. Maybe having users filtering with
if message['type'] = ...is enough.