lambdadb 0.2.1__tar.gz → 0.3.0__tar.gz
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.
Potentially problematic release.
This version of lambdadb might be problematic. Click here for more details.
- {lambdadb-0.2.1 → lambdadb-0.3.0}/PKG-INFO +46 -49
- {lambdadb-0.2.1 → lambdadb-0.3.0}/README-PYPI.md +45 -48
- {lambdadb-0.2.1 → lambdadb-0.3.0}/pyproject.toml +1 -1
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/_version.py +3 -3
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/sdk.py +4 -4
- lambdadb-0.2.1/src/lambdadb/projects.py +0 -17
- {lambdadb-0.2.1 → lambdadb-0.3.0}/LICENSE +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/py.typed +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/__init__.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/_hooks/__init__.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/_hooks/registration.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/_hooks/sdkhooks.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/_hooks/types.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/basesdk.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/collections.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/docs.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/__init__.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/apierror.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/badrequest_error.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/internalservererror.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/resourcealreadyexists_error.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/resourcenotfound_error.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/toomanyrequests_error.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/errors/unauthenticated_error.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/httpclient.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/__init__.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/bulkupsertdocsop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/collectionresponse.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/createcollectionop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/deletecollectionop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/deletedocsop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/fetchdocsop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/getbulkupsertdocsop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/getcollectionop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/indexconfigs_union.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/listcollectionsop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/querycollectionop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/security.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/status.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/updatecollectionop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/models/upsertdocsop.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/py.typed +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/sdkconfiguration.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/types/__init__.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/types/basemodel.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/__init__.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/annotations.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/datetimes.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/enums.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/eventstreaming.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/forms.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/headers.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/logger.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/metadata.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/queryparams.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/requestbodies.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/retries.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/security.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/serializers.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/url.py +0 -0
- {lambdadb-0.2.1 → lambdadb-0.3.0}/src/lambdadb/utils/values.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: lambdadb
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Summary: Python Client SDK Generated by Speakeasy.
|
|
5
5
|
Author: Speakeasy
|
|
6
6
|
Requires-Python: >=3.9.2
|
|
@@ -98,9 +98,9 @@ It's also possible to write a standalone Python script without needing to set up
|
|
|
98
98
|
# ]
|
|
99
99
|
# ///
|
|
100
100
|
|
|
101
|
-
from lambdadb import
|
|
101
|
+
from lambdadb import LambdaDB
|
|
102
102
|
|
|
103
|
-
sdk =
|
|
103
|
+
sdk = LambdaDB(
|
|
104
104
|
# SDK arguments
|
|
105
105
|
)
|
|
106
106
|
|
|
@@ -128,14 +128,14 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
|
|
|
128
128
|
|
|
129
129
|
```python
|
|
130
130
|
# Synchronous Example
|
|
131
|
-
from lambdadb import
|
|
131
|
+
from lambdadb import LambdaDB
|
|
132
132
|
|
|
133
133
|
|
|
134
|
-
with
|
|
134
|
+
with LambdaDB(
|
|
135
135
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
136
|
-
) as
|
|
136
|
+
) as lambda_db:
|
|
137
137
|
|
|
138
|
-
res =
|
|
138
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
139
139
|
|
|
140
140
|
# Handle response
|
|
141
141
|
print(res)
|
|
@@ -147,15 +147,15 @@ The same SDK client can also be used to make asychronous requests by importing a
|
|
|
147
147
|
```python
|
|
148
148
|
# Asynchronous Example
|
|
149
149
|
import asyncio
|
|
150
|
-
from lambdadb import
|
|
150
|
+
from lambdadb import LambdaDB
|
|
151
151
|
|
|
152
152
|
async def main():
|
|
153
153
|
|
|
154
|
-
async with
|
|
154
|
+
async with LambdaDB(
|
|
155
155
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
156
|
-
) as
|
|
156
|
+
) as lambda_db:
|
|
157
157
|
|
|
158
|
-
res = await
|
|
158
|
+
res = await lambda_db.collections.list_async(project_name="<value>")
|
|
159
159
|
|
|
160
160
|
# Handle response
|
|
161
161
|
print(res)
|
|
@@ -177,14 +177,14 @@ This SDK supports the following security scheme globally:
|
|
|
177
177
|
|
|
178
178
|
To authenticate with the API the `project_api_key` parameter must be set when initializing the SDK client instance. For example:
|
|
179
179
|
```python
|
|
180
|
-
from lambdadb import
|
|
180
|
+
from lambdadb import LambdaDB
|
|
181
181
|
|
|
182
182
|
|
|
183
|
-
with
|
|
183
|
+
with LambdaDB(
|
|
184
184
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
185
|
-
) as
|
|
185
|
+
) as lambda_db:
|
|
186
186
|
|
|
187
|
-
res =
|
|
187
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
188
188
|
|
|
189
189
|
# Handle response
|
|
190
190
|
print(res)
|
|
@@ -198,11 +198,7 @@ with Lambdadb(
|
|
|
198
198
|
<details open>
|
|
199
199
|
<summary>Available methods</summary>
|
|
200
200
|
|
|
201
|
-
|
|
202
|
-
### [projects](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/projects/README.md)
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
#### [projects.collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md)
|
|
201
|
+
### [collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md)
|
|
206
202
|
|
|
207
203
|
* [list](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#list) - List all collections in an existing project.
|
|
208
204
|
* [create](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#create) - Create an collection.
|
|
@@ -211,7 +207,7 @@ with Lambdadb(
|
|
|
211
207
|
* [update](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#update) - Configure an collection.
|
|
212
208
|
* [query](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#query) - Search an collection with a query and return the most similar documents.
|
|
213
209
|
|
|
214
|
-
#### [
|
|
210
|
+
#### [collections.docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md)
|
|
215
211
|
|
|
216
212
|
* [upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#upsert) - Upsert documents into an collection. Note that the maximum supported payload size is 6MB.
|
|
217
213
|
* [get_bulk_upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#get_bulk_upsert) - Request required info to upload documents.
|
|
@@ -219,6 +215,7 @@ with Lambdadb(
|
|
|
219
215
|
* [delete](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#delete) - Delete documents by document IDs or query filter from an collection.
|
|
220
216
|
* [fetch](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#fetch) - Lookup and return documents by document IDs from an collection.
|
|
221
217
|
|
|
218
|
+
|
|
222
219
|
</details>
|
|
223
220
|
<!-- End Available Resources and Operations [operations] -->
|
|
224
221
|
|
|
@@ -229,15 +226,15 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an
|
|
|
229
226
|
|
|
230
227
|
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
231
228
|
```python
|
|
232
|
-
from lambdadb import
|
|
229
|
+
from lambdadb import LambdaDB
|
|
233
230
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
234
231
|
|
|
235
232
|
|
|
236
|
-
with
|
|
233
|
+
with LambdaDB(
|
|
237
234
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
238
|
-
) as
|
|
235
|
+
) as lambda_db:
|
|
239
236
|
|
|
240
|
-
res =
|
|
237
|
+
res = lambda_db.collections.list(project_name="<value>",
|
|
241
238
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
242
239
|
|
|
243
240
|
# Handle response
|
|
@@ -247,16 +244,16 @@ with Lambdadb(
|
|
|
247
244
|
|
|
248
245
|
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
|
|
249
246
|
```python
|
|
250
|
-
from lambdadb import
|
|
247
|
+
from lambdadb import LambdaDB
|
|
251
248
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
252
249
|
|
|
253
250
|
|
|
254
|
-
with
|
|
251
|
+
with LambdaDB(
|
|
255
252
|
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
256
253
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
257
|
-
) as
|
|
254
|
+
) as lambda_db:
|
|
258
255
|
|
|
259
|
-
res =
|
|
256
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
260
257
|
|
|
261
258
|
# Handle response
|
|
262
259
|
print(res)
|
|
@@ -291,16 +288,16 @@ When custom error responses are specified for an operation, the SDK may also rai
|
|
|
291
288
|
### Example
|
|
292
289
|
|
|
293
290
|
```python
|
|
294
|
-
from lambdadb import
|
|
291
|
+
from lambdadb import LambdaDB, errors
|
|
295
292
|
|
|
296
293
|
|
|
297
|
-
with
|
|
294
|
+
with LambdaDB(
|
|
298
295
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
299
|
-
) as
|
|
296
|
+
) as lambda_db:
|
|
300
297
|
res = None
|
|
301
298
|
try:
|
|
302
299
|
|
|
303
|
-
res =
|
|
300
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
304
301
|
|
|
305
302
|
# Handle response
|
|
306
303
|
print(res)
|
|
@@ -330,15 +327,15 @@ with Lambdadb(
|
|
|
330
327
|
|
|
331
328
|
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
|
|
332
329
|
```python
|
|
333
|
-
from lambdadb import
|
|
330
|
+
from lambdadb import LambdaDB
|
|
334
331
|
|
|
335
332
|
|
|
336
|
-
with
|
|
333
|
+
with LambdaDB(
|
|
337
334
|
server_url="https://{baseUrl}",
|
|
338
335
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
339
|
-
) as
|
|
336
|
+
) as lambda_db:
|
|
340
337
|
|
|
341
|
-
res =
|
|
338
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
342
339
|
|
|
343
340
|
# Handle response
|
|
344
341
|
print(res)
|
|
@@ -355,16 +352,16 @@ This allows you to wrap the client with your own custom logic, such as adding cu
|
|
|
355
352
|
|
|
356
353
|
For example, you could specify a header for every request that this sdk makes as follows:
|
|
357
354
|
```python
|
|
358
|
-
from lambdadb import
|
|
355
|
+
from lambdadb import LambdaDB
|
|
359
356
|
import httpx
|
|
360
357
|
|
|
361
358
|
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
362
|
-
s =
|
|
359
|
+
s = LambdaDB(client=http_client)
|
|
363
360
|
```
|
|
364
361
|
|
|
365
362
|
or you could wrap the client with your own custom logic:
|
|
366
363
|
```python
|
|
367
|
-
from lambdadb import
|
|
364
|
+
from lambdadb import LambdaDB
|
|
368
365
|
from lambdadb.httpclient import AsyncHttpClient
|
|
369
366
|
import httpx
|
|
370
367
|
|
|
@@ -423,33 +420,33 @@ class CustomClient(AsyncHttpClient):
|
|
|
423
420
|
extensions=extensions,
|
|
424
421
|
)
|
|
425
422
|
|
|
426
|
-
s =
|
|
423
|
+
s = LambdaDB(async_client=CustomClient(httpx.AsyncClient()))
|
|
427
424
|
```
|
|
428
425
|
<!-- End Custom HTTP Client [http-client] -->
|
|
429
426
|
|
|
430
427
|
<!-- Start Resource Management [resource-management] -->
|
|
431
428
|
## Resource Management
|
|
432
429
|
|
|
433
|
-
The `
|
|
430
|
+
The `LambdaDB` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
434
431
|
|
|
435
432
|
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
436
433
|
|
|
437
434
|
```python
|
|
438
|
-
from lambdadb import
|
|
435
|
+
from lambdadb import LambdaDB
|
|
439
436
|
def main():
|
|
440
437
|
|
|
441
|
-
with
|
|
438
|
+
with LambdaDB(
|
|
442
439
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
443
|
-
) as
|
|
440
|
+
) as lambda_db:
|
|
444
441
|
# Rest of application here...
|
|
445
442
|
|
|
446
443
|
|
|
447
444
|
# Or when using async:
|
|
448
445
|
async def amain():
|
|
449
446
|
|
|
450
|
-
async with
|
|
447
|
+
async with LambdaDB(
|
|
451
448
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
452
|
-
) as
|
|
449
|
+
) as lambda_db:
|
|
453
450
|
# Rest of application here...
|
|
454
451
|
```
|
|
455
452
|
<!-- End Resource Management [resource-management] -->
|
|
@@ -461,11 +458,11 @@ You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
|
461
458
|
|
|
462
459
|
You can pass your own logger class directly into your SDK.
|
|
463
460
|
```python
|
|
464
|
-
from lambdadb import
|
|
461
|
+
from lambdadb import LambdaDB
|
|
465
462
|
import logging
|
|
466
463
|
|
|
467
464
|
logging.basicConfig(level=logging.DEBUG)
|
|
468
|
-
s =
|
|
465
|
+
s = LambdaDB(debug_logger=logging.getLogger("lambdadb"))
|
|
469
466
|
```
|
|
470
467
|
|
|
471
468
|
You can also enable a default debug logger by setting an environment variable `LAMBDADB_DEBUG` to true.
|
|
@@ -81,9 +81,9 @@ It's also possible to write a standalone Python script without needing to set up
|
|
|
81
81
|
# ]
|
|
82
82
|
# ///
|
|
83
83
|
|
|
84
|
-
from lambdadb import
|
|
84
|
+
from lambdadb import LambdaDB
|
|
85
85
|
|
|
86
|
-
sdk =
|
|
86
|
+
sdk = LambdaDB(
|
|
87
87
|
# SDK arguments
|
|
88
88
|
)
|
|
89
89
|
|
|
@@ -111,14 +111,14 @@ Generally, the SDK will work well with most IDEs out of the box. However, when u
|
|
|
111
111
|
|
|
112
112
|
```python
|
|
113
113
|
# Synchronous Example
|
|
114
|
-
from lambdadb import
|
|
114
|
+
from lambdadb import LambdaDB
|
|
115
115
|
|
|
116
116
|
|
|
117
|
-
with
|
|
117
|
+
with LambdaDB(
|
|
118
118
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
119
|
-
) as
|
|
119
|
+
) as lambda_db:
|
|
120
120
|
|
|
121
|
-
res =
|
|
121
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
122
122
|
|
|
123
123
|
# Handle response
|
|
124
124
|
print(res)
|
|
@@ -130,15 +130,15 @@ The same SDK client can also be used to make asychronous requests by importing a
|
|
|
130
130
|
```python
|
|
131
131
|
# Asynchronous Example
|
|
132
132
|
import asyncio
|
|
133
|
-
from lambdadb import
|
|
133
|
+
from lambdadb import LambdaDB
|
|
134
134
|
|
|
135
135
|
async def main():
|
|
136
136
|
|
|
137
|
-
async with
|
|
137
|
+
async with LambdaDB(
|
|
138
138
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
139
|
-
) as
|
|
139
|
+
) as lambda_db:
|
|
140
140
|
|
|
141
|
-
res = await
|
|
141
|
+
res = await lambda_db.collections.list_async(project_name="<value>")
|
|
142
142
|
|
|
143
143
|
# Handle response
|
|
144
144
|
print(res)
|
|
@@ -160,14 +160,14 @@ This SDK supports the following security scheme globally:
|
|
|
160
160
|
|
|
161
161
|
To authenticate with the API the `project_api_key` parameter must be set when initializing the SDK client instance. For example:
|
|
162
162
|
```python
|
|
163
|
-
from lambdadb import
|
|
163
|
+
from lambdadb import LambdaDB
|
|
164
164
|
|
|
165
165
|
|
|
166
|
-
with
|
|
166
|
+
with LambdaDB(
|
|
167
167
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
168
|
-
) as
|
|
168
|
+
) as lambda_db:
|
|
169
169
|
|
|
170
|
-
res =
|
|
170
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
171
171
|
|
|
172
172
|
# Handle response
|
|
173
173
|
print(res)
|
|
@@ -181,11 +181,7 @@ with Lambdadb(
|
|
|
181
181
|
<details open>
|
|
182
182
|
<summary>Available methods</summary>
|
|
183
183
|
|
|
184
|
-
|
|
185
|
-
### [projects](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/projects/README.md)
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
#### [projects.collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md)
|
|
184
|
+
### [collections](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md)
|
|
189
185
|
|
|
190
186
|
* [list](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#list) - List all collections in an existing project.
|
|
191
187
|
* [create](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#create) - Create an collection.
|
|
@@ -194,7 +190,7 @@ with Lambdadb(
|
|
|
194
190
|
* [update](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#update) - Configure an collection.
|
|
195
191
|
* [query](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/collections/README.md#query) - Search an collection with a query and return the most similar documents.
|
|
196
192
|
|
|
197
|
-
#### [
|
|
193
|
+
#### [collections.docs](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md)
|
|
198
194
|
|
|
199
195
|
* [upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#upsert) - Upsert documents into an collection. Note that the maximum supported payload size is 6MB.
|
|
200
196
|
* [get_bulk_upsert](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#get_bulk_upsert) - Request required info to upload documents.
|
|
@@ -202,6 +198,7 @@ with Lambdadb(
|
|
|
202
198
|
* [delete](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#delete) - Delete documents by document IDs or query filter from an collection.
|
|
203
199
|
* [fetch](https://github.com/lambdadb/lambdadb-python-client/blob/master/docs/sdks/docs/README.md#fetch) - Lookup and return documents by document IDs from an collection.
|
|
204
200
|
|
|
201
|
+
|
|
205
202
|
</details>
|
|
206
203
|
<!-- End Available Resources and Operations [operations] -->
|
|
207
204
|
|
|
@@ -212,15 +209,15 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an
|
|
|
212
209
|
|
|
213
210
|
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
214
211
|
```python
|
|
215
|
-
from lambdadb import
|
|
212
|
+
from lambdadb import LambdaDB
|
|
216
213
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
217
214
|
|
|
218
215
|
|
|
219
|
-
with
|
|
216
|
+
with LambdaDB(
|
|
220
217
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
221
|
-
) as
|
|
218
|
+
) as lambda_db:
|
|
222
219
|
|
|
223
|
-
res =
|
|
220
|
+
res = lambda_db.collections.list(project_name="<value>",
|
|
224
221
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
225
222
|
|
|
226
223
|
# Handle response
|
|
@@ -230,16 +227,16 @@ with Lambdadb(
|
|
|
230
227
|
|
|
231
228
|
If you'd like to override the default retry strategy for all operations that support retries, you can use the `retry_config` optional parameter when initializing the SDK:
|
|
232
229
|
```python
|
|
233
|
-
from lambdadb import
|
|
230
|
+
from lambdadb import LambdaDB
|
|
234
231
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
235
232
|
|
|
236
233
|
|
|
237
|
-
with
|
|
234
|
+
with LambdaDB(
|
|
238
235
|
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
239
236
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
240
|
-
) as
|
|
237
|
+
) as lambda_db:
|
|
241
238
|
|
|
242
|
-
res =
|
|
239
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
243
240
|
|
|
244
241
|
# Handle response
|
|
245
242
|
print(res)
|
|
@@ -274,16 +271,16 @@ When custom error responses are specified for an operation, the SDK may also rai
|
|
|
274
271
|
### Example
|
|
275
272
|
|
|
276
273
|
```python
|
|
277
|
-
from lambdadb import
|
|
274
|
+
from lambdadb import LambdaDB, errors
|
|
278
275
|
|
|
279
276
|
|
|
280
|
-
with
|
|
277
|
+
with LambdaDB(
|
|
281
278
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
282
|
-
) as
|
|
279
|
+
) as lambda_db:
|
|
283
280
|
res = None
|
|
284
281
|
try:
|
|
285
282
|
|
|
286
|
-
res =
|
|
283
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
287
284
|
|
|
288
285
|
# Handle response
|
|
289
286
|
print(res)
|
|
@@ -313,15 +310,15 @@ with Lambdadb(
|
|
|
313
310
|
|
|
314
311
|
The default server can be overridden globally by passing a URL to the `server_url: str` optional parameter when initializing the SDK client instance. For example:
|
|
315
312
|
```python
|
|
316
|
-
from lambdadb import
|
|
313
|
+
from lambdadb import LambdaDB
|
|
317
314
|
|
|
318
315
|
|
|
319
|
-
with
|
|
316
|
+
with LambdaDB(
|
|
320
317
|
server_url="https://{baseUrl}",
|
|
321
318
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
322
|
-
) as
|
|
319
|
+
) as lambda_db:
|
|
323
320
|
|
|
324
|
-
res =
|
|
321
|
+
res = lambda_db.collections.list(project_name="<value>")
|
|
325
322
|
|
|
326
323
|
# Handle response
|
|
327
324
|
print(res)
|
|
@@ -338,16 +335,16 @@ This allows you to wrap the client with your own custom logic, such as adding cu
|
|
|
338
335
|
|
|
339
336
|
For example, you could specify a header for every request that this sdk makes as follows:
|
|
340
337
|
```python
|
|
341
|
-
from lambdadb import
|
|
338
|
+
from lambdadb import LambdaDB
|
|
342
339
|
import httpx
|
|
343
340
|
|
|
344
341
|
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
345
|
-
s =
|
|
342
|
+
s = LambdaDB(client=http_client)
|
|
346
343
|
```
|
|
347
344
|
|
|
348
345
|
or you could wrap the client with your own custom logic:
|
|
349
346
|
```python
|
|
350
|
-
from lambdadb import
|
|
347
|
+
from lambdadb import LambdaDB
|
|
351
348
|
from lambdadb.httpclient import AsyncHttpClient
|
|
352
349
|
import httpx
|
|
353
350
|
|
|
@@ -406,33 +403,33 @@ class CustomClient(AsyncHttpClient):
|
|
|
406
403
|
extensions=extensions,
|
|
407
404
|
)
|
|
408
405
|
|
|
409
|
-
s =
|
|
406
|
+
s = LambdaDB(async_client=CustomClient(httpx.AsyncClient()))
|
|
410
407
|
```
|
|
411
408
|
<!-- End Custom HTTP Client [http-client] -->
|
|
412
409
|
|
|
413
410
|
<!-- Start Resource Management [resource-management] -->
|
|
414
411
|
## Resource Management
|
|
415
412
|
|
|
416
|
-
The `
|
|
413
|
+
The `LambdaDB` class implements the context manager protocol and registers a finalizer function to close the underlying sync and async HTTPX clients it uses under the hood. This will close HTTP connections, release memory and free up other resources held by the SDK. In short-lived Python programs and notebooks that make a few SDK method calls, resource management may not be a concern. However, in longer-lived programs, it is beneficial to create a single SDK instance via a [context manager][context-manager] and reuse it across the application.
|
|
417
414
|
|
|
418
415
|
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
419
416
|
|
|
420
417
|
```python
|
|
421
|
-
from lambdadb import
|
|
418
|
+
from lambdadb import LambdaDB
|
|
422
419
|
def main():
|
|
423
420
|
|
|
424
|
-
with
|
|
421
|
+
with LambdaDB(
|
|
425
422
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
426
|
-
) as
|
|
423
|
+
) as lambda_db:
|
|
427
424
|
# Rest of application here...
|
|
428
425
|
|
|
429
426
|
|
|
430
427
|
# Or when using async:
|
|
431
428
|
async def amain():
|
|
432
429
|
|
|
433
|
-
async with
|
|
430
|
+
async with LambdaDB(
|
|
434
431
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
435
|
-
) as
|
|
432
|
+
) as lambda_db:
|
|
436
433
|
# Rest of application here...
|
|
437
434
|
```
|
|
438
435
|
<!-- End Resource Management [resource-management] -->
|
|
@@ -444,11 +441,11 @@ You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
|
444
441
|
|
|
445
442
|
You can pass your own logger class directly into your SDK.
|
|
446
443
|
```python
|
|
447
|
-
from lambdadb import
|
|
444
|
+
from lambdadb import LambdaDB
|
|
448
445
|
import logging
|
|
449
446
|
|
|
450
447
|
logging.basicConfig(level=logging.DEBUG)
|
|
451
|
-
s =
|
|
448
|
+
s = LambdaDB(debug_logger=logging.getLogger("lambdadb"))
|
|
452
449
|
```
|
|
453
450
|
|
|
454
451
|
You can also enable a default debug logger by setting an environment variable `LAMBDADB_DEBUG` to true.
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "lambdadb"
|
|
6
|
-
__version__: str = "0.
|
|
6
|
+
__version__: str = "0.3.0"
|
|
7
7
|
__openapi_doc_version__: str = "1.1.0"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.
|
|
8
|
+
__gen_version__: str = "2.634.2"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.3.0 2.634.2 1.1.0 lambdadb"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -14,15 +14,15 @@ from typing import Any, Callable, Dict, Optional, TYPE_CHECKING, Union, cast
|
|
|
14
14
|
import weakref
|
|
15
15
|
|
|
16
16
|
if TYPE_CHECKING:
|
|
17
|
-
from lambdadb.
|
|
17
|
+
from lambdadb.collections import Collections
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class LambdaDB(BaseSDK):
|
|
21
21
|
r"""LambdaDB API: LambdaDB Open API Spec"""
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
collections: "Collections"
|
|
24
24
|
_sub_sdk_map = {
|
|
25
|
-
"
|
|
25
|
+
"collections": ("lambdadb.collections", "Collections"),
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
def __init__(
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
|
2
|
-
|
|
3
|
-
from .basesdk import BaseSDK
|
|
4
|
-
from .sdkconfiguration import SDKConfiguration
|
|
5
|
-
from lambdadb.collections import Collections
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Projects(BaseSDK):
|
|
9
|
-
collections: Collections
|
|
10
|
-
|
|
11
|
-
def __init__(self, sdk_config: SDKConfiguration) -> None:
|
|
12
|
-
BaseSDK.__init__(self, sdk_config)
|
|
13
|
-
self.sdk_configuration = sdk_config
|
|
14
|
-
self._init_sdks()
|
|
15
|
-
|
|
16
|
-
def _init_sdks(self):
|
|
17
|
-
self.collections = Collections(self.sdk_configuration)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|