worqhat 3.2.0__py3-none-any.whl → 3.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- worqhat/_base_client.py +4 -1
- worqhat/_client.py +24 -16
- worqhat/_files.py +5 -5
- worqhat/_version.py +1 -1
- worqhat/resources/__init__.py +14 -0
- worqhat/resources/db.py +593 -0
- worqhat/resources/flows.py +235 -21
- worqhat/types/__init__.py +17 -3
- worqhat/types/db_delete_records_params.py +15 -0
- worqhat/types/db_delete_records_response.py +18 -0
- worqhat/types/db_execute_query_params.py +12 -0
- worqhat/types/db_execute_query_response.py +21 -0
- worqhat/types/db_insert_record_params.py +15 -0
- worqhat/types/db_insert_record_response.py +15 -0
- worqhat/types/db_process_nl_query_params.py +15 -0
- worqhat/types/db_process_nl_query_response.py +18 -0
- worqhat/types/db_update_records_params.py +18 -0
- worqhat/types/db_update_records_response.py +18 -0
- worqhat/types/{flow_retrieve_metrics_params.py → flow_get_metrics_params.py} +2 -2
- worqhat/types/{flow_retrieve_metrics_response.py → flow_get_metrics_response.py} +2 -2
- worqhat/types/flow_trigger_with_file_params.py +17 -0
- worqhat/types/flow_trigger_with_file_response.py +18 -0
- worqhat/types/flow_trigger_with_payload_params.py +12 -0
- worqhat/types/flow_trigger_with_payload_response.py +20 -0
- worqhat/types/{retrieve_server_info_response.py → get_server_info_response.py} +2 -2
- {worqhat-3.2.0.dist-info → worqhat-3.4.0.dist-info}/METADATA +51 -17
- worqhat-3.4.0.dist-info/RECORD +53 -0
- worqhat-3.2.0.dist-info/RECORD +0 -38
- {worqhat-3.2.0.dist-info → worqhat-3.4.0.dist-info}/WHEEL +0 -0
- {worqhat-3.2.0.dist-info → worqhat-3.4.0.dist-info}/licenses/LICENSE +0 -0
worqhat/resources/db.py
ADDED
|
@@ -0,0 +1,593 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..types import (
|
|
8
|
+
db_execute_query_params,
|
|
9
|
+
db_insert_record_params,
|
|
10
|
+
db_delete_records_params,
|
|
11
|
+
db_update_records_params,
|
|
12
|
+
db_process_nl_query_params,
|
|
13
|
+
)
|
|
14
|
+
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
15
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
16
|
+
from .._compat import cached_property
|
|
17
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
18
|
+
from .._response import (
|
|
19
|
+
to_raw_response_wrapper,
|
|
20
|
+
to_streamed_response_wrapper,
|
|
21
|
+
async_to_raw_response_wrapper,
|
|
22
|
+
async_to_streamed_response_wrapper,
|
|
23
|
+
)
|
|
24
|
+
from .._base_client import make_request_options
|
|
25
|
+
from ..types.db_execute_query_response import DBExecuteQueryResponse
|
|
26
|
+
from ..types.db_insert_record_response import DBInsertRecordResponse
|
|
27
|
+
from ..types.db_delete_records_response import DBDeleteRecordsResponse
|
|
28
|
+
from ..types.db_update_records_response import DBUpdateRecordsResponse
|
|
29
|
+
from ..types.db_process_nl_query_response import DBProcessNlQueryResponse
|
|
30
|
+
|
|
31
|
+
__all__ = ["DBResource", "AsyncDBResource"]
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DBResource(SyncAPIResource):
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_raw_response(self) -> DBResourceWithRawResponse:
|
|
37
|
+
"""
|
|
38
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
39
|
+
the raw response object instead of the parsed content.
|
|
40
|
+
|
|
41
|
+
For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#accessing-raw-response-data-eg-headers
|
|
42
|
+
"""
|
|
43
|
+
return DBResourceWithRawResponse(self)
|
|
44
|
+
|
|
45
|
+
@cached_property
|
|
46
|
+
def with_streaming_response(self) -> DBResourceWithStreamingResponse:
|
|
47
|
+
"""
|
|
48
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
49
|
+
|
|
50
|
+
For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#with_streaming_response
|
|
51
|
+
"""
|
|
52
|
+
return DBResourceWithStreamingResponse(self)
|
|
53
|
+
|
|
54
|
+
def delete_records(
|
|
55
|
+
self,
|
|
56
|
+
*,
|
|
57
|
+
table: str,
|
|
58
|
+
where: object,
|
|
59
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
60
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
61
|
+
extra_headers: Headers | None = None,
|
|
62
|
+
extra_query: Query | None = None,
|
|
63
|
+
extra_body: Body | None = None,
|
|
64
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
65
|
+
) -> DBDeleteRecordsResponse:
|
|
66
|
+
"""
|
|
67
|
+
Deletes records from the specified table that match the where conditions.
|
|
68
|
+
Organization ID filtering is automatically applied for multi-tenant security.
|
|
69
|
+
|
|
70
|
+
Args:
|
|
71
|
+
table: Table name to delete from
|
|
72
|
+
|
|
73
|
+
where: Where conditions
|
|
74
|
+
|
|
75
|
+
extra_headers: Send extra headers
|
|
76
|
+
|
|
77
|
+
extra_query: Add additional query parameters to the request
|
|
78
|
+
|
|
79
|
+
extra_body: Add additional JSON properties to the request
|
|
80
|
+
|
|
81
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
82
|
+
"""
|
|
83
|
+
return self._delete(
|
|
84
|
+
"/db/delete",
|
|
85
|
+
body=maybe_transform(
|
|
86
|
+
{
|
|
87
|
+
"table": table,
|
|
88
|
+
"where": where,
|
|
89
|
+
},
|
|
90
|
+
db_delete_records_params.DBDeleteRecordsParams,
|
|
91
|
+
),
|
|
92
|
+
options=make_request_options(
|
|
93
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
94
|
+
),
|
|
95
|
+
cast_to=DBDeleteRecordsResponse,
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def execute_query(
|
|
99
|
+
self,
|
|
100
|
+
*,
|
|
101
|
+
query: str,
|
|
102
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
103
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
104
|
+
extra_headers: Headers | None = None,
|
|
105
|
+
extra_query: Query | None = None,
|
|
106
|
+
extra_body: Body | None = None,
|
|
107
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
108
|
+
) -> DBExecuteQueryResponse:
|
|
109
|
+
"""Executes a raw SQL query directly against ClickHouse (WorqDB).
|
|
110
|
+
|
|
111
|
+
This endpoint
|
|
112
|
+
provides direct SQL access with security guardrails to prevent destructive
|
|
113
|
+
operations.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
query: SQL query to execute
|
|
117
|
+
|
|
118
|
+
extra_headers: Send extra headers
|
|
119
|
+
|
|
120
|
+
extra_query: Add additional query parameters to the request
|
|
121
|
+
|
|
122
|
+
extra_body: Add additional JSON properties to the request
|
|
123
|
+
|
|
124
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
125
|
+
"""
|
|
126
|
+
return self._post(
|
|
127
|
+
"/db/query",
|
|
128
|
+
body=maybe_transform({"query": query}, db_execute_query_params.DBExecuteQueryParams),
|
|
129
|
+
options=make_request_options(
|
|
130
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
131
|
+
),
|
|
132
|
+
cast_to=DBExecuteQueryResponse,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
def insert_record(
|
|
136
|
+
self,
|
|
137
|
+
*,
|
|
138
|
+
data: object,
|
|
139
|
+
table: str,
|
|
140
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
141
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
142
|
+
extra_headers: Headers | None = None,
|
|
143
|
+
extra_query: Query | None = None,
|
|
144
|
+
extra_body: Body | None = None,
|
|
145
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
146
|
+
) -> DBInsertRecordResponse:
|
|
147
|
+
"""Inserts a new record into the specified table.
|
|
148
|
+
|
|
149
|
+
Organization ID is automatically
|
|
150
|
+
added for multi-tenant security.
|
|
151
|
+
|
|
152
|
+
Args:
|
|
153
|
+
data: Data to insert
|
|
154
|
+
|
|
155
|
+
table: Table name to insert into
|
|
156
|
+
|
|
157
|
+
extra_headers: Send extra headers
|
|
158
|
+
|
|
159
|
+
extra_query: Add additional query parameters to the request
|
|
160
|
+
|
|
161
|
+
extra_body: Add additional JSON properties to the request
|
|
162
|
+
|
|
163
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
164
|
+
"""
|
|
165
|
+
return self._post(
|
|
166
|
+
"/db/insert",
|
|
167
|
+
body=maybe_transform(
|
|
168
|
+
{
|
|
169
|
+
"data": data,
|
|
170
|
+
"table": table,
|
|
171
|
+
},
|
|
172
|
+
db_insert_record_params.DBInsertRecordParams,
|
|
173
|
+
),
|
|
174
|
+
options=make_request_options(
|
|
175
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
176
|
+
),
|
|
177
|
+
cast_to=DBInsertRecordResponse,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
def process_nl_query(
|
|
181
|
+
self,
|
|
182
|
+
*,
|
|
183
|
+
question: str,
|
|
184
|
+
context: object | NotGiven = NOT_GIVEN,
|
|
185
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
186
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
187
|
+
extra_headers: Headers | None = None,
|
|
188
|
+
extra_query: Query | None = None,
|
|
189
|
+
extra_body: Body | None = None,
|
|
190
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
191
|
+
) -> DBProcessNlQueryResponse:
|
|
192
|
+
"""
|
|
193
|
+
Converts a natural language question into a SQL query and executes it.
|
|
194
|
+
Organization ID filtering is automatically applied for multi-tenant security.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
question: Natural language question
|
|
198
|
+
|
|
199
|
+
context: Additional context for the query
|
|
200
|
+
|
|
201
|
+
extra_headers: Send extra headers
|
|
202
|
+
|
|
203
|
+
extra_query: Add additional query parameters to the request
|
|
204
|
+
|
|
205
|
+
extra_body: Add additional JSON properties to the request
|
|
206
|
+
|
|
207
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
208
|
+
"""
|
|
209
|
+
return self._post(
|
|
210
|
+
"/db/nl-query",
|
|
211
|
+
body=maybe_transform(
|
|
212
|
+
{
|
|
213
|
+
"question": question,
|
|
214
|
+
"context": context,
|
|
215
|
+
},
|
|
216
|
+
db_process_nl_query_params.DBProcessNlQueryParams,
|
|
217
|
+
),
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
220
|
+
),
|
|
221
|
+
cast_to=DBProcessNlQueryResponse,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
def update_records(
|
|
225
|
+
self,
|
|
226
|
+
*,
|
|
227
|
+
data: object,
|
|
228
|
+
table: str,
|
|
229
|
+
where: object,
|
|
230
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
231
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
232
|
+
extra_headers: Headers | None = None,
|
|
233
|
+
extra_query: Query | None = None,
|
|
234
|
+
extra_body: Body | None = None,
|
|
235
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
236
|
+
) -> DBUpdateRecordsResponse:
|
|
237
|
+
"""
|
|
238
|
+
Updates records in the specified table that match the where conditions.
|
|
239
|
+
Organization ID filtering is automatically applied for multi-tenant security.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
data: Data to update
|
|
243
|
+
|
|
244
|
+
table: Table name to update
|
|
245
|
+
|
|
246
|
+
where: Where conditions
|
|
247
|
+
|
|
248
|
+
extra_headers: Send extra headers
|
|
249
|
+
|
|
250
|
+
extra_query: Add additional query parameters to the request
|
|
251
|
+
|
|
252
|
+
extra_body: Add additional JSON properties to the request
|
|
253
|
+
|
|
254
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
255
|
+
"""
|
|
256
|
+
return self._put(
|
|
257
|
+
"/db/update",
|
|
258
|
+
body=maybe_transform(
|
|
259
|
+
{
|
|
260
|
+
"data": data,
|
|
261
|
+
"table": table,
|
|
262
|
+
"where": where,
|
|
263
|
+
},
|
|
264
|
+
db_update_records_params.DBUpdateRecordsParams,
|
|
265
|
+
),
|
|
266
|
+
options=make_request_options(
|
|
267
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
268
|
+
),
|
|
269
|
+
cast_to=DBUpdateRecordsResponse,
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
class AsyncDBResource(AsyncAPIResource):
|
|
274
|
+
@cached_property
|
|
275
|
+
def with_raw_response(self) -> AsyncDBResourceWithRawResponse:
|
|
276
|
+
"""
|
|
277
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
278
|
+
the raw response object instead of the parsed content.
|
|
279
|
+
|
|
280
|
+
For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#accessing-raw-response-data-eg-headers
|
|
281
|
+
"""
|
|
282
|
+
return AsyncDBResourceWithRawResponse(self)
|
|
283
|
+
|
|
284
|
+
@cached_property
|
|
285
|
+
def with_streaming_response(self) -> AsyncDBResourceWithStreamingResponse:
|
|
286
|
+
"""
|
|
287
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
288
|
+
|
|
289
|
+
For more information, see https://www.github.com/WorqHat/worqhat-python-sdk#with_streaming_response
|
|
290
|
+
"""
|
|
291
|
+
return AsyncDBResourceWithStreamingResponse(self)
|
|
292
|
+
|
|
293
|
+
async def delete_records(
|
|
294
|
+
self,
|
|
295
|
+
*,
|
|
296
|
+
table: str,
|
|
297
|
+
where: object,
|
|
298
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
299
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
300
|
+
extra_headers: Headers | None = None,
|
|
301
|
+
extra_query: Query | None = None,
|
|
302
|
+
extra_body: Body | None = None,
|
|
303
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
304
|
+
) -> DBDeleteRecordsResponse:
|
|
305
|
+
"""
|
|
306
|
+
Deletes records from the specified table that match the where conditions.
|
|
307
|
+
Organization ID filtering is automatically applied for multi-tenant security.
|
|
308
|
+
|
|
309
|
+
Args:
|
|
310
|
+
table: Table name to delete from
|
|
311
|
+
|
|
312
|
+
where: Where conditions
|
|
313
|
+
|
|
314
|
+
extra_headers: Send extra headers
|
|
315
|
+
|
|
316
|
+
extra_query: Add additional query parameters to the request
|
|
317
|
+
|
|
318
|
+
extra_body: Add additional JSON properties to the request
|
|
319
|
+
|
|
320
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
321
|
+
"""
|
|
322
|
+
return await self._delete(
|
|
323
|
+
"/db/delete",
|
|
324
|
+
body=await async_maybe_transform(
|
|
325
|
+
{
|
|
326
|
+
"table": table,
|
|
327
|
+
"where": where,
|
|
328
|
+
},
|
|
329
|
+
db_delete_records_params.DBDeleteRecordsParams,
|
|
330
|
+
),
|
|
331
|
+
options=make_request_options(
|
|
332
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
333
|
+
),
|
|
334
|
+
cast_to=DBDeleteRecordsResponse,
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
async def execute_query(
|
|
338
|
+
self,
|
|
339
|
+
*,
|
|
340
|
+
query: str,
|
|
341
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
342
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
343
|
+
extra_headers: Headers | None = None,
|
|
344
|
+
extra_query: Query | None = None,
|
|
345
|
+
extra_body: Body | None = None,
|
|
346
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
347
|
+
) -> DBExecuteQueryResponse:
|
|
348
|
+
"""Executes a raw SQL query directly against ClickHouse (WorqDB).
|
|
349
|
+
|
|
350
|
+
This endpoint
|
|
351
|
+
provides direct SQL access with security guardrails to prevent destructive
|
|
352
|
+
operations.
|
|
353
|
+
|
|
354
|
+
Args:
|
|
355
|
+
query: SQL query to execute
|
|
356
|
+
|
|
357
|
+
extra_headers: Send extra headers
|
|
358
|
+
|
|
359
|
+
extra_query: Add additional query parameters to the request
|
|
360
|
+
|
|
361
|
+
extra_body: Add additional JSON properties to the request
|
|
362
|
+
|
|
363
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
364
|
+
"""
|
|
365
|
+
return await self._post(
|
|
366
|
+
"/db/query",
|
|
367
|
+
body=await async_maybe_transform({"query": query}, db_execute_query_params.DBExecuteQueryParams),
|
|
368
|
+
options=make_request_options(
|
|
369
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
370
|
+
),
|
|
371
|
+
cast_to=DBExecuteQueryResponse,
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
async def insert_record(
|
|
375
|
+
self,
|
|
376
|
+
*,
|
|
377
|
+
data: object,
|
|
378
|
+
table: str,
|
|
379
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
380
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
381
|
+
extra_headers: Headers | None = None,
|
|
382
|
+
extra_query: Query | None = None,
|
|
383
|
+
extra_body: Body | None = None,
|
|
384
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
385
|
+
) -> DBInsertRecordResponse:
|
|
386
|
+
"""Inserts a new record into the specified table.
|
|
387
|
+
|
|
388
|
+
Organization ID is automatically
|
|
389
|
+
added for multi-tenant security.
|
|
390
|
+
|
|
391
|
+
Args:
|
|
392
|
+
data: Data to insert
|
|
393
|
+
|
|
394
|
+
table: Table name to insert into
|
|
395
|
+
|
|
396
|
+
extra_headers: Send extra headers
|
|
397
|
+
|
|
398
|
+
extra_query: Add additional query parameters to the request
|
|
399
|
+
|
|
400
|
+
extra_body: Add additional JSON properties to the request
|
|
401
|
+
|
|
402
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
403
|
+
"""
|
|
404
|
+
return await self._post(
|
|
405
|
+
"/db/insert",
|
|
406
|
+
body=await async_maybe_transform(
|
|
407
|
+
{
|
|
408
|
+
"data": data,
|
|
409
|
+
"table": table,
|
|
410
|
+
},
|
|
411
|
+
db_insert_record_params.DBInsertRecordParams,
|
|
412
|
+
),
|
|
413
|
+
options=make_request_options(
|
|
414
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
415
|
+
),
|
|
416
|
+
cast_to=DBInsertRecordResponse,
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
async def process_nl_query(
|
|
420
|
+
self,
|
|
421
|
+
*,
|
|
422
|
+
question: str,
|
|
423
|
+
context: object | NotGiven = NOT_GIVEN,
|
|
424
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
425
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
426
|
+
extra_headers: Headers | None = None,
|
|
427
|
+
extra_query: Query | None = None,
|
|
428
|
+
extra_body: Body | None = None,
|
|
429
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
430
|
+
) -> DBProcessNlQueryResponse:
|
|
431
|
+
"""
|
|
432
|
+
Converts a natural language question into a SQL query and executes it.
|
|
433
|
+
Organization ID filtering is automatically applied for multi-tenant security.
|
|
434
|
+
|
|
435
|
+
Args:
|
|
436
|
+
question: Natural language question
|
|
437
|
+
|
|
438
|
+
context: Additional context for the query
|
|
439
|
+
|
|
440
|
+
extra_headers: Send extra headers
|
|
441
|
+
|
|
442
|
+
extra_query: Add additional query parameters to the request
|
|
443
|
+
|
|
444
|
+
extra_body: Add additional JSON properties to the request
|
|
445
|
+
|
|
446
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
447
|
+
"""
|
|
448
|
+
return await self._post(
|
|
449
|
+
"/db/nl-query",
|
|
450
|
+
body=await async_maybe_transform(
|
|
451
|
+
{
|
|
452
|
+
"question": question,
|
|
453
|
+
"context": context,
|
|
454
|
+
},
|
|
455
|
+
db_process_nl_query_params.DBProcessNlQueryParams,
|
|
456
|
+
),
|
|
457
|
+
options=make_request_options(
|
|
458
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
459
|
+
),
|
|
460
|
+
cast_to=DBProcessNlQueryResponse,
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
async def update_records(
|
|
464
|
+
self,
|
|
465
|
+
*,
|
|
466
|
+
data: object,
|
|
467
|
+
table: str,
|
|
468
|
+
where: object,
|
|
469
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
470
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
471
|
+
extra_headers: Headers | None = None,
|
|
472
|
+
extra_query: Query | None = None,
|
|
473
|
+
extra_body: Body | None = None,
|
|
474
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
475
|
+
) -> DBUpdateRecordsResponse:
|
|
476
|
+
"""
|
|
477
|
+
Updates records in the specified table that match the where conditions.
|
|
478
|
+
Organization ID filtering is automatically applied for multi-tenant security.
|
|
479
|
+
|
|
480
|
+
Args:
|
|
481
|
+
data: Data to update
|
|
482
|
+
|
|
483
|
+
table: Table name to update
|
|
484
|
+
|
|
485
|
+
where: Where conditions
|
|
486
|
+
|
|
487
|
+
extra_headers: Send extra headers
|
|
488
|
+
|
|
489
|
+
extra_query: Add additional query parameters to the request
|
|
490
|
+
|
|
491
|
+
extra_body: Add additional JSON properties to the request
|
|
492
|
+
|
|
493
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
494
|
+
"""
|
|
495
|
+
return await self._put(
|
|
496
|
+
"/db/update",
|
|
497
|
+
body=await async_maybe_transform(
|
|
498
|
+
{
|
|
499
|
+
"data": data,
|
|
500
|
+
"table": table,
|
|
501
|
+
"where": where,
|
|
502
|
+
},
|
|
503
|
+
db_update_records_params.DBUpdateRecordsParams,
|
|
504
|
+
),
|
|
505
|
+
options=make_request_options(
|
|
506
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
507
|
+
),
|
|
508
|
+
cast_to=DBUpdateRecordsResponse,
|
|
509
|
+
)
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
class DBResourceWithRawResponse:
|
|
513
|
+
def __init__(self, db: DBResource) -> None:
|
|
514
|
+
self._db = db
|
|
515
|
+
|
|
516
|
+
self.delete_records = to_raw_response_wrapper(
|
|
517
|
+
db.delete_records,
|
|
518
|
+
)
|
|
519
|
+
self.execute_query = to_raw_response_wrapper(
|
|
520
|
+
db.execute_query,
|
|
521
|
+
)
|
|
522
|
+
self.insert_record = to_raw_response_wrapper(
|
|
523
|
+
db.insert_record,
|
|
524
|
+
)
|
|
525
|
+
self.process_nl_query = to_raw_response_wrapper(
|
|
526
|
+
db.process_nl_query,
|
|
527
|
+
)
|
|
528
|
+
self.update_records = to_raw_response_wrapper(
|
|
529
|
+
db.update_records,
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
class AsyncDBResourceWithRawResponse:
|
|
534
|
+
def __init__(self, db: AsyncDBResource) -> None:
|
|
535
|
+
self._db = db
|
|
536
|
+
|
|
537
|
+
self.delete_records = async_to_raw_response_wrapper(
|
|
538
|
+
db.delete_records,
|
|
539
|
+
)
|
|
540
|
+
self.execute_query = async_to_raw_response_wrapper(
|
|
541
|
+
db.execute_query,
|
|
542
|
+
)
|
|
543
|
+
self.insert_record = async_to_raw_response_wrapper(
|
|
544
|
+
db.insert_record,
|
|
545
|
+
)
|
|
546
|
+
self.process_nl_query = async_to_raw_response_wrapper(
|
|
547
|
+
db.process_nl_query,
|
|
548
|
+
)
|
|
549
|
+
self.update_records = async_to_raw_response_wrapper(
|
|
550
|
+
db.update_records,
|
|
551
|
+
)
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
class DBResourceWithStreamingResponse:
|
|
555
|
+
def __init__(self, db: DBResource) -> None:
|
|
556
|
+
self._db = db
|
|
557
|
+
|
|
558
|
+
self.delete_records = to_streamed_response_wrapper(
|
|
559
|
+
db.delete_records,
|
|
560
|
+
)
|
|
561
|
+
self.execute_query = to_streamed_response_wrapper(
|
|
562
|
+
db.execute_query,
|
|
563
|
+
)
|
|
564
|
+
self.insert_record = to_streamed_response_wrapper(
|
|
565
|
+
db.insert_record,
|
|
566
|
+
)
|
|
567
|
+
self.process_nl_query = to_streamed_response_wrapper(
|
|
568
|
+
db.process_nl_query,
|
|
569
|
+
)
|
|
570
|
+
self.update_records = to_streamed_response_wrapper(
|
|
571
|
+
db.update_records,
|
|
572
|
+
)
|
|
573
|
+
|
|
574
|
+
|
|
575
|
+
class AsyncDBResourceWithStreamingResponse:
|
|
576
|
+
def __init__(self, db: AsyncDBResource) -> None:
|
|
577
|
+
self._db = db
|
|
578
|
+
|
|
579
|
+
self.delete_records = async_to_streamed_response_wrapper(
|
|
580
|
+
db.delete_records,
|
|
581
|
+
)
|
|
582
|
+
self.execute_query = async_to_streamed_response_wrapper(
|
|
583
|
+
db.execute_query,
|
|
584
|
+
)
|
|
585
|
+
self.insert_record = async_to_streamed_response_wrapper(
|
|
586
|
+
db.insert_record,
|
|
587
|
+
)
|
|
588
|
+
self.process_nl_query = async_to_streamed_response_wrapper(
|
|
589
|
+
db.process_nl_query,
|
|
590
|
+
)
|
|
591
|
+
self.update_records = async_to_streamed_response_wrapper(
|
|
592
|
+
db.update_records,
|
|
593
|
+
)
|