lambdadb 0.2.0__tar.gz → 0.2.2__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.0 → lambdadb-0.2.2}/PKG-INFO +43 -43
- {lambdadb-0.2.0 → lambdadb-0.2.2}/README-PYPI.md +42 -42
- {lambdadb-0.2.0 → lambdadb-0.2.2}/pyproject.toml +1 -1
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/_hooks/__init__.py +1 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/_hooks/sdkhooks.py +2 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/_version.py +3 -3
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/collections.py +0 -6
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/querycollectionop.py +0 -5
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/sdk.py +1 -1
- {lambdadb-0.2.0 → lambdadb-0.2.2}/LICENSE +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/py.typed +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/__init__.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/_hooks/registration.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/_hooks/types.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/basesdk.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/docs.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/__init__.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/apierror.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/badrequest_error.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/internalservererror.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/resourcealreadyexists_error.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/resourcenotfound_error.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/toomanyrequests_error.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/errors/unauthenticated_error.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/httpclient.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/__init__.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/bulkupsertdocsop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/collectionresponse.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/createcollectionop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/deletecollectionop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/deletedocsop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/fetchdocsop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/getbulkupsertdocsop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/getcollectionop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/indexconfigs_union.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/listcollectionsop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/security.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/status.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/updatecollectionop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/models/upsertdocsop.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/projects.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/py.typed +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/sdkconfiguration.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/types/__init__.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/types/basemodel.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/__init__.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/annotations.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/datetimes.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/enums.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/eventstreaming.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/forms.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/headers.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/logger.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/metadata.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/queryparams.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/requestbodies.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/retries.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/security.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/serializers.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/url.py +0 -0
- {lambdadb-0.2.0 → lambdadb-0.2.2}/src/lambdadb/utils/values.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: lambdadb
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
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.projects.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.projects.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.projects.collections.list(project_name="<value>")
|
|
188
188
|
|
|
189
189
|
# Handle response
|
|
190
190
|
print(res)
|
|
@@ -229,15 +229,15 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an
|
|
|
229
229
|
|
|
230
230
|
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
231
231
|
```python
|
|
232
|
-
from lambdadb import
|
|
232
|
+
from lambdadb import LambdaDB
|
|
233
233
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
234
234
|
|
|
235
235
|
|
|
236
|
-
with
|
|
236
|
+
with LambdaDB(
|
|
237
237
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
238
|
-
) as
|
|
238
|
+
) as lambda_db:
|
|
239
239
|
|
|
240
|
-
res =
|
|
240
|
+
res = lambda_db.projects.collections.list(project_name="<value>",
|
|
241
241
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
242
242
|
|
|
243
243
|
# Handle response
|
|
@@ -247,16 +247,16 @@ with Lambdadb(
|
|
|
247
247
|
|
|
248
248
|
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
249
|
```python
|
|
250
|
-
from lambdadb import
|
|
250
|
+
from lambdadb import LambdaDB
|
|
251
251
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
252
252
|
|
|
253
253
|
|
|
254
|
-
with
|
|
254
|
+
with LambdaDB(
|
|
255
255
|
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
256
256
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
257
|
-
) as
|
|
257
|
+
) as lambda_db:
|
|
258
258
|
|
|
259
|
-
res =
|
|
259
|
+
res = lambda_db.projects.collections.list(project_name="<value>")
|
|
260
260
|
|
|
261
261
|
# Handle response
|
|
262
262
|
print(res)
|
|
@@ -291,16 +291,16 @@ When custom error responses are specified for an operation, the SDK may also rai
|
|
|
291
291
|
### Example
|
|
292
292
|
|
|
293
293
|
```python
|
|
294
|
-
from lambdadb import
|
|
294
|
+
from lambdadb import LambdaDB, errors
|
|
295
295
|
|
|
296
296
|
|
|
297
|
-
with
|
|
297
|
+
with LambdaDB(
|
|
298
298
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
299
|
-
) as
|
|
299
|
+
) as lambda_db:
|
|
300
300
|
res = None
|
|
301
301
|
try:
|
|
302
302
|
|
|
303
|
-
res =
|
|
303
|
+
res = lambda_db.projects.collections.list(project_name="<value>")
|
|
304
304
|
|
|
305
305
|
# Handle response
|
|
306
306
|
print(res)
|
|
@@ -330,15 +330,15 @@ with Lambdadb(
|
|
|
330
330
|
|
|
331
331
|
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
332
|
```python
|
|
333
|
-
from lambdadb import
|
|
333
|
+
from lambdadb import LambdaDB
|
|
334
334
|
|
|
335
335
|
|
|
336
|
-
with
|
|
336
|
+
with LambdaDB(
|
|
337
337
|
server_url="https://{baseUrl}",
|
|
338
338
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
339
|
-
) as
|
|
339
|
+
) as lambda_db:
|
|
340
340
|
|
|
341
|
-
res =
|
|
341
|
+
res = lambda_db.projects.collections.list(project_name="<value>")
|
|
342
342
|
|
|
343
343
|
# Handle response
|
|
344
344
|
print(res)
|
|
@@ -355,16 +355,16 @@ This allows you to wrap the client with your own custom logic, such as adding cu
|
|
|
355
355
|
|
|
356
356
|
For example, you could specify a header for every request that this sdk makes as follows:
|
|
357
357
|
```python
|
|
358
|
-
from lambdadb import
|
|
358
|
+
from lambdadb import LambdaDB
|
|
359
359
|
import httpx
|
|
360
360
|
|
|
361
361
|
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
362
|
-
s =
|
|
362
|
+
s = LambdaDB(client=http_client)
|
|
363
363
|
```
|
|
364
364
|
|
|
365
365
|
or you could wrap the client with your own custom logic:
|
|
366
366
|
```python
|
|
367
|
-
from lambdadb import
|
|
367
|
+
from lambdadb import LambdaDB
|
|
368
368
|
from lambdadb.httpclient import AsyncHttpClient
|
|
369
369
|
import httpx
|
|
370
370
|
|
|
@@ -423,33 +423,33 @@ class CustomClient(AsyncHttpClient):
|
|
|
423
423
|
extensions=extensions,
|
|
424
424
|
)
|
|
425
425
|
|
|
426
|
-
s =
|
|
426
|
+
s = LambdaDB(async_client=CustomClient(httpx.AsyncClient()))
|
|
427
427
|
```
|
|
428
428
|
<!-- End Custom HTTP Client [http-client] -->
|
|
429
429
|
|
|
430
430
|
<!-- Start Resource Management [resource-management] -->
|
|
431
431
|
## Resource Management
|
|
432
432
|
|
|
433
|
-
The `
|
|
433
|
+
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
434
|
|
|
435
435
|
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
436
436
|
|
|
437
437
|
```python
|
|
438
|
-
from lambdadb import
|
|
438
|
+
from lambdadb import LambdaDB
|
|
439
439
|
def main():
|
|
440
440
|
|
|
441
|
-
with
|
|
441
|
+
with LambdaDB(
|
|
442
442
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
443
|
-
) as
|
|
443
|
+
) as lambda_db:
|
|
444
444
|
# Rest of application here...
|
|
445
445
|
|
|
446
446
|
|
|
447
447
|
# Or when using async:
|
|
448
448
|
async def amain():
|
|
449
449
|
|
|
450
|
-
async with
|
|
450
|
+
async with LambdaDB(
|
|
451
451
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
452
|
-
) as
|
|
452
|
+
) as lambda_db:
|
|
453
453
|
# Rest of application here...
|
|
454
454
|
```
|
|
455
455
|
<!-- End Resource Management [resource-management] -->
|
|
@@ -461,11 +461,11 @@ You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
|
461
461
|
|
|
462
462
|
You can pass your own logger class directly into your SDK.
|
|
463
463
|
```python
|
|
464
|
-
from lambdadb import
|
|
464
|
+
from lambdadb import LambdaDB
|
|
465
465
|
import logging
|
|
466
466
|
|
|
467
467
|
logging.basicConfig(level=logging.DEBUG)
|
|
468
|
-
s =
|
|
468
|
+
s = LambdaDB(debug_logger=logging.getLogger("lambdadb"))
|
|
469
469
|
```
|
|
470
470
|
|
|
471
471
|
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.projects.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.projects.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.projects.collections.list(project_name="<value>")
|
|
171
171
|
|
|
172
172
|
# Handle response
|
|
173
173
|
print(res)
|
|
@@ -212,15 +212,15 @@ Some of the endpoints in this SDK support retries. If you use the SDK without an
|
|
|
212
212
|
|
|
213
213
|
To change the default retry strategy for a single API call, simply provide a `RetryConfig` object to the call:
|
|
214
214
|
```python
|
|
215
|
-
from lambdadb import
|
|
215
|
+
from lambdadb import LambdaDB
|
|
216
216
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
217
217
|
|
|
218
218
|
|
|
219
|
-
with
|
|
219
|
+
with LambdaDB(
|
|
220
220
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
221
|
-
) as
|
|
221
|
+
) as lambda_db:
|
|
222
222
|
|
|
223
|
-
res =
|
|
223
|
+
res = lambda_db.projects.collections.list(project_name="<value>",
|
|
224
224
|
RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False))
|
|
225
225
|
|
|
226
226
|
# Handle response
|
|
@@ -230,16 +230,16 @@ with Lambdadb(
|
|
|
230
230
|
|
|
231
231
|
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
232
|
```python
|
|
233
|
-
from lambdadb import
|
|
233
|
+
from lambdadb import LambdaDB
|
|
234
234
|
from lambdadb.utils import BackoffStrategy, RetryConfig
|
|
235
235
|
|
|
236
236
|
|
|
237
|
-
with
|
|
237
|
+
with LambdaDB(
|
|
238
238
|
retry_config=RetryConfig("backoff", BackoffStrategy(1, 50, 1.1, 100), False),
|
|
239
239
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
240
|
-
) as
|
|
240
|
+
) as lambda_db:
|
|
241
241
|
|
|
242
|
-
res =
|
|
242
|
+
res = lambda_db.projects.collections.list(project_name="<value>")
|
|
243
243
|
|
|
244
244
|
# Handle response
|
|
245
245
|
print(res)
|
|
@@ -274,16 +274,16 @@ When custom error responses are specified for an operation, the SDK may also rai
|
|
|
274
274
|
### Example
|
|
275
275
|
|
|
276
276
|
```python
|
|
277
|
-
from lambdadb import
|
|
277
|
+
from lambdadb import LambdaDB, errors
|
|
278
278
|
|
|
279
279
|
|
|
280
|
-
with
|
|
280
|
+
with LambdaDB(
|
|
281
281
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
282
|
-
) as
|
|
282
|
+
) as lambda_db:
|
|
283
283
|
res = None
|
|
284
284
|
try:
|
|
285
285
|
|
|
286
|
-
res =
|
|
286
|
+
res = lambda_db.projects.collections.list(project_name="<value>")
|
|
287
287
|
|
|
288
288
|
# Handle response
|
|
289
289
|
print(res)
|
|
@@ -313,15 +313,15 @@ with Lambdadb(
|
|
|
313
313
|
|
|
314
314
|
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
315
|
```python
|
|
316
|
-
from lambdadb import
|
|
316
|
+
from lambdadb import LambdaDB
|
|
317
317
|
|
|
318
318
|
|
|
319
|
-
with
|
|
319
|
+
with LambdaDB(
|
|
320
320
|
server_url="https://{baseUrl}",
|
|
321
321
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
322
|
-
) as
|
|
322
|
+
) as lambda_db:
|
|
323
323
|
|
|
324
|
-
res =
|
|
324
|
+
res = lambda_db.projects.collections.list(project_name="<value>")
|
|
325
325
|
|
|
326
326
|
# Handle response
|
|
327
327
|
print(res)
|
|
@@ -338,16 +338,16 @@ This allows you to wrap the client with your own custom logic, such as adding cu
|
|
|
338
338
|
|
|
339
339
|
For example, you could specify a header for every request that this sdk makes as follows:
|
|
340
340
|
```python
|
|
341
|
-
from lambdadb import
|
|
341
|
+
from lambdadb import LambdaDB
|
|
342
342
|
import httpx
|
|
343
343
|
|
|
344
344
|
http_client = httpx.Client(headers={"x-custom-header": "someValue"})
|
|
345
|
-
s =
|
|
345
|
+
s = LambdaDB(client=http_client)
|
|
346
346
|
```
|
|
347
347
|
|
|
348
348
|
or you could wrap the client with your own custom logic:
|
|
349
349
|
```python
|
|
350
|
-
from lambdadb import
|
|
350
|
+
from lambdadb import LambdaDB
|
|
351
351
|
from lambdadb.httpclient import AsyncHttpClient
|
|
352
352
|
import httpx
|
|
353
353
|
|
|
@@ -406,33 +406,33 @@ class CustomClient(AsyncHttpClient):
|
|
|
406
406
|
extensions=extensions,
|
|
407
407
|
)
|
|
408
408
|
|
|
409
|
-
s =
|
|
409
|
+
s = LambdaDB(async_client=CustomClient(httpx.AsyncClient()))
|
|
410
410
|
```
|
|
411
411
|
<!-- End Custom HTTP Client [http-client] -->
|
|
412
412
|
|
|
413
413
|
<!-- Start Resource Management [resource-management] -->
|
|
414
414
|
## Resource Management
|
|
415
415
|
|
|
416
|
-
The `
|
|
416
|
+
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
417
|
|
|
418
418
|
[context-manager]: https://docs.python.org/3/reference/datamodel.html#context-managers
|
|
419
419
|
|
|
420
420
|
```python
|
|
421
|
-
from lambdadb import
|
|
421
|
+
from lambdadb import LambdaDB
|
|
422
422
|
def main():
|
|
423
423
|
|
|
424
|
-
with
|
|
424
|
+
with LambdaDB(
|
|
425
425
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
426
|
-
) as
|
|
426
|
+
) as lambda_db:
|
|
427
427
|
# Rest of application here...
|
|
428
428
|
|
|
429
429
|
|
|
430
430
|
# Or when using async:
|
|
431
431
|
async def amain():
|
|
432
432
|
|
|
433
|
-
async with
|
|
433
|
+
async with LambdaDB(
|
|
434
434
|
project_api_key="<YOUR_PROJECT_API_KEY>",
|
|
435
|
-
) as
|
|
435
|
+
) as lambda_db:
|
|
436
436
|
# Rest of application here...
|
|
437
437
|
```
|
|
438
438
|
<!-- End Resource Management [resource-management] -->
|
|
@@ -444,11 +444,11 @@ You can setup your SDK to emit debug logs for SDK requests and responses.
|
|
|
444
444
|
|
|
445
445
|
You can pass your own logger class directly into your SDK.
|
|
446
446
|
```python
|
|
447
|
-
from lambdadb import
|
|
447
|
+
from lambdadb import LambdaDB
|
|
448
448
|
import logging
|
|
449
449
|
|
|
450
450
|
logging.basicConfig(level=logging.DEBUG)
|
|
451
|
-
s =
|
|
451
|
+
s = LambdaDB(debug_logger=logging.getLogger("lambdadb"))
|
|
452
452
|
```
|
|
453
453
|
|
|
454
454
|
You can also enable a default debug logger by setting an environment variable `LAMBDADB_DEBUG` to true.
|
|
@@ -11,6 +11,7 @@ from .types import (
|
|
|
11
11
|
AfterErrorHook,
|
|
12
12
|
Hooks,
|
|
13
13
|
)
|
|
14
|
+
from .registration import init_hooks
|
|
14
15
|
from typing import List, Optional, Tuple
|
|
15
16
|
from lambdadb.sdkconfiguration import SDKConfiguration
|
|
16
17
|
|
|
@@ -21,6 +22,7 @@ class SDKHooks(Hooks):
|
|
|
21
22
|
self.before_request_hooks: List[BeforeRequestHook] = []
|
|
22
23
|
self.after_success_hooks: List[AfterSuccessHook] = []
|
|
23
24
|
self.after_error_hooks: List[AfterErrorHook] = []
|
|
25
|
+
init_hooks(self)
|
|
24
26
|
|
|
25
27
|
def register_sdk_init_hook(self, hook: SDKInitHook) -> None:
|
|
26
28
|
self.sdk_init_hooks.append(hook)
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "lambdadb"
|
|
6
|
-
__version__: str = "0.2.
|
|
6
|
+
__version__: str = "0.2.2"
|
|
7
7
|
__openapi_doc_version__: str = "1.1.0"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.2.
|
|
8
|
+
__gen_version__: str = "2.632.2"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.2.2 2.632.2 1.1.0 lambdadb"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
|
@@ -1342,7 +1342,6 @@ class Collections(BaseSDK):
|
|
|
1342
1342
|
include_vectors: Optional[bool] = False,
|
|
1343
1343
|
sort: Optional[Union[List[models.Sort], List[models.SortTypedDict]]] = None,
|
|
1344
1344
|
fields: Optional[List[str]] = None,
|
|
1345
|
-
track_scores: Optional[bool] = False,
|
|
1346
1345
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1347
1346
|
server_url: Optional[str] = None,
|
|
1348
1347
|
timeout_ms: Optional[int] = None,
|
|
@@ -1358,7 +1357,6 @@ class Collections(BaseSDK):
|
|
|
1358
1357
|
:param include_vectors: If your application need to include vector values in the response, set includeVectors to true.
|
|
1359
1358
|
:param sort: List of field name, sort direction pairs.
|
|
1360
1359
|
:param fields: List of field name to include in results
|
|
1361
|
-
:param track_scores: If your application needs to track scores with sorting, set trackScores to true.
|
|
1362
1360
|
:param retries: Override the default retry configuration for this method
|
|
1363
1361
|
:param server_url: Override the default server URL for this method
|
|
1364
1362
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1384,7 +1382,6 @@ class Collections(BaseSDK):
|
|
|
1384
1382
|
include_vectors=include_vectors,
|
|
1385
1383
|
sort=utils.get_pydantic_model(sort, Optional[List[models.Sort]]),
|
|
1386
1384
|
fields=fields,
|
|
1387
|
-
track_scores=track_scores,
|
|
1388
1385
|
),
|
|
1389
1386
|
)
|
|
1390
1387
|
|
|
@@ -1497,7 +1494,6 @@ class Collections(BaseSDK):
|
|
|
1497
1494
|
include_vectors: Optional[bool] = False,
|
|
1498
1495
|
sort: Optional[Union[List[models.Sort], List[models.SortTypedDict]]] = None,
|
|
1499
1496
|
fields: Optional[List[str]] = None,
|
|
1500
|
-
track_scores: Optional[bool] = False,
|
|
1501
1497
|
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
1502
1498
|
server_url: Optional[str] = None,
|
|
1503
1499
|
timeout_ms: Optional[int] = None,
|
|
@@ -1513,7 +1509,6 @@ class Collections(BaseSDK):
|
|
|
1513
1509
|
:param include_vectors: If your application need to include vector values in the response, set includeVectors to true.
|
|
1514
1510
|
:param sort: List of field name, sort direction pairs.
|
|
1515
1511
|
:param fields: List of field name to include in results
|
|
1516
|
-
:param track_scores: If your application needs to track scores with sorting, set trackScores to true.
|
|
1517
1512
|
:param retries: Override the default retry configuration for this method
|
|
1518
1513
|
:param server_url: Override the default server URL for this method
|
|
1519
1514
|
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
@@ -1539,7 +1534,6 @@ class Collections(BaseSDK):
|
|
|
1539
1534
|
include_vectors=include_vectors,
|
|
1540
1535
|
sort=utils.get_pydantic_model(sort, Optional[List[models.Sort]]),
|
|
1541
1536
|
fields=fields,
|
|
1542
|
-
track_scores=track_scores,
|
|
1543
1537
|
),
|
|
1544
1538
|
)
|
|
1545
1539
|
|
|
@@ -37,8 +37,6 @@ class QueryCollectionRequestBodyTypedDict(TypedDict):
|
|
|
37
37
|
r"""List of field name, sort direction pairs."""
|
|
38
38
|
fields: NotRequired[List[str]]
|
|
39
39
|
r"""List of field name to include in results"""
|
|
40
|
-
track_scores: NotRequired[bool]
|
|
41
|
-
r"""If your application needs to track scores with sorting, set trackScores to true."""
|
|
42
40
|
|
|
43
41
|
|
|
44
42
|
class QueryCollectionRequestBody(BaseModel):
|
|
@@ -64,9 +62,6 @@ class QueryCollectionRequestBody(BaseModel):
|
|
|
64
62
|
fields: Optional[List[str]] = None
|
|
65
63
|
r"""List of field name to include in results"""
|
|
66
64
|
|
|
67
|
-
track_scores: Annotated[Optional[bool], pydantic.Field(alias="trackScores")] = False
|
|
68
|
-
r"""If your application needs to track scores with sorting, set trackScores to true."""
|
|
69
|
-
|
|
70
65
|
|
|
71
66
|
class QueryCollectionRequestTypedDict(TypedDict):
|
|
72
67
|
project_name: str
|
|
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
|