worqhat 3.9.0__py3-none-any.whl → 4.1.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/__init__.py +8 -89
- worqhat/client.py +62 -0
- worqhat/exceptions.py +43 -0
- worqhat/http_client.py +171 -0
- worqhat/py.typed +1 -0
- worqhat/resources/__init__.py +5 -59
- worqhat/resources/database.py +293 -0
- worqhat/resources/flows.py +61 -409
- worqhat/resources/storage.py +41 -431
- worqhat-4.1.0.dist-info/METADATA +538 -0
- worqhat-4.1.0.dist-info/RECORD +13 -0
- {worqhat-3.9.0.dist-info → worqhat-4.1.0.dist-info}/WHEEL +2 -1
- worqhat-4.1.0.dist-info/top_level.txt +1 -0
- worqhat/_base_client.py +0 -1995
- worqhat/_client.py +0 -484
- worqhat/_compat.py +0 -219
- worqhat/_constants.py +0 -14
- worqhat/_exceptions.py +0 -108
- worqhat/_files.py +0 -123
- worqhat/_models.py +0 -835
- worqhat/_qs.py +0 -150
- worqhat/_resource.py +0 -43
- worqhat/_response.py +0 -830
- worqhat/_streaming.py +0 -333
- worqhat/_types.py +0 -260
- worqhat/_utils/__init__.py +0 -64
- worqhat/_utils/_compat.py +0 -45
- worqhat/_utils/_datetime_parse.py +0 -136
- worqhat/_utils/_logs.py +0 -25
- worqhat/_utils/_proxy.py +0 -65
- worqhat/_utils/_reflection.py +0 -42
- worqhat/_utils/_resources_proxy.py +0 -24
- worqhat/_utils/_streams.py +0 -12
- worqhat/_utils/_sync.py +0 -86
- worqhat/_utils/_transform.py +0 -457
- worqhat/_utils/_typing.py +0 -156
- worqhat/_utils/_utils.py +0 -421
- worqhat/_version.py +0 -4
- worqhat/lib/.keep +0 -4
- worqhat/resources/db/__init__.py +0 -33
- worqhat/resources/db/db.py +0 -800
- worqhat/resources/db/tables.py +0 -389
- worqhat/resources/health.py +0 -143
- worqhat/types/__init__.py +0 -32
- worqhat/types/db/__init__.py +0 -10
- worqhat/types/db/table_get_row_count_params.py +0 -12
- worqhat/types/db/table_get_row_count_response.py +0 -15
- worqhat/types/db/table_list_params.py +0 -15
- worqhat/types/db/table_list_response.py +0 -26
- worqhat/types/db/table_retrieve_schema_params.py +0 -12
- worqhat/types/db/table_retrieve_schema_response.py +0 -29
- worqhat/types/db_delete_records_params.py +0 -19
- worqhat/types/db_delete_records_response.py +0 -18
- worqhat/types/db_execute_batch_params.py +0 -36
- worqhat/types/db_execute_batch_response.py +0 -27
- worqhat/types/db_execute_query_params.py +0 -24
- worqhat/types/db_execute_query_response.py +0 -21
- worqhat/types/db_insert_record_params.py +0 -19
- worqhat/types/db_insert_record_response.py +0 -15
- worqhat/types/db_process_nl_query_params.py +0 -19
- worqhat/types/db_process_nl_query_response.py +0 -18
- worqhat/types/db_update_records_params.py +0 -22
- worqhat/types/db_update_records_response.py +0 -18
- worqhat/types/flow_get_metrics_params.py +0 -25
- worqhat/types/flow_get_metrics_response.py +0 -55
- worqhat/types/flow_trigger_with_file_params.py +0 -17
- worqhat/types/flow_trigger_with_file_response.py +0 -18
- worqhat/types/flow_trigger_with_payload_params.py +0 -13
- worqhat/types/flow_trigger_with_payload_response.py +0 -20
- worqhat/types/get_server_info_response.py +0 -15
- worqhat/types/health_check_response.py +0 -33
- worqhat/types/storage_delete_file_by_id_response.py +0 -18
- worqhat/types/storage_retrieve_file_by_id_response.py +0 -33
- worqhat/types/storage_retrieve_file_by_path_params.py +0 -12
- worqhat/types/storage_retrieve_file_by_path_response.py +0 -33
- worqhat/types/storage_upload_file_params.py +0 -17
- worqhat/types/storage_upload_file_response.py +0 -33
- worqhat-3.9.0.dist-info/METADATA +0 -432
- worqhat-3.9.0.dist-info/RECORD +0 -73
- worqhat-3.9.0.dist-info/licenses/LICENSE +0 -201
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: worqhat
|
|
3
|
+
Version: 4.1.0
|
|
4
|
+
Summary: Python SDK for Worqhat API
|
|
5
|
+
Home-page: https://github.com/worqhat/worqhat-python
|
|
6
|
+
Author: Worqhat
|
|
7
|
+
Author-email: Worqhat <support@worqhat.com>
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Homepage, https://worqhat.com
|
|
10
|
+
Project-URL: Documentation, https://docs.worqhat.com
|
|
11
|
+
Project-URL: Repository, https://github.com/worqhat/worqhat-python
|
|
12
|
+
Keywords: worqhat,api,sdk,database,workflows
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: requests>=2.31.0
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
28
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
30
|
+
Provides-Extra: security
|
|
31
|
+
Requires-Dist: pip-audit>=2.6.0; extra == "security"
|
|
32
|
+
Requires-Dist: bandit>=1.7.5; extra == "security"
|
|
33
|
+
Requires-Dist: safety>=2.3.0; extra == "security"
|
|
34
|
+
Dynamic: author
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
|
|
38
|
+
# Worqhat Python SDK
|
|
39
|
+
|
|
40
|
+
[](https://pypi.org/project/worqhat/)
|
|
41
|
+
[](https://circleci.com/gh/worqhat/worqhat-api)
|
|
42
|
+
[](https://snyk.io/test/github/worqhat/worqhat-api?targetFile=python-sdk/pyproject.toml)
|
|
43
|
+
[](https://github.com/PyCQA/bandit)
|
|
44
|
+
[](https://pypi.org/project/worqhat/)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
|
|
47
|
+
Official Python SDK for the Worqhat API. This SDK provides a type-safe interface to interact with Worqhat's database, workflows, and storage services.
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pip install worqhat
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Quick Start
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from worqhat import Worqhat
|
|
59
|
+
|
|
60
|
+
client = Worqhat(api_key="your-api-key")
|
|
61
|
+
# Or use environment variable: export WORQHAT_API_KEY=your-api-key
|
|
62
|
+
# client = Worqhat()
|
|
63
|
+
|
|
64
|
+
response = client.db.execute_query(query="SELECT * FROM users")
|
|
65
|
+
print(response["data"])
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Configuration
|
|
69
|
+
|
|
70
|
+
### Basic Configuration
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from worqhat import Worqhat
|
|
74
|
+
|
|
75
|
+
client = Worqhat(api_key="your-api-key")
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Advanced Configuration
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
client = Worqhat(
|
|
82
|
+
api_key="your-api-key",
|
|
83
|
+
base_url="https://api.worqhat.app", # Custom base URL (optional)
|
|
84
|
+
target="app", # Backend target: 'app' or 'fyi' (optional)
|
|
85
|
+
timeout=60, # Request timeout in seconds (optional)
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Using Environment Variables
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
import os
|
|
93
|
+
|
|
94
|
+
# Set environment variable
|
|
95
|
+
os.environ["WORQHAT_API_KEY"] = "your-api-key"
|
|
96
|
+
|
|
97
|
+
# API key will be read automatically
|
|
98
|
+
client = Worqhat()
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Context Manager
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
with Worqhat(api_key="your-api-key") as client:
|
|
105
|
+
response = client.db.execute_query(query="SELECT * FROM users")
|
|
106
|
+
print(response["data"])
|
|
107
|
+
# Session is automatically closed
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Database Operations
|
|
111
|
+
|
|
112
|
+
### Execute Raw SQL Query
|
|
113
|
+
|
|
114
|
+
Execute SQL queries with named or positional parameters.
|
|
115
|
+
|
|
116
|
+
#### Named Parameters
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
response = client.db.execute_query(
|
|
120
|
+
query="SELECT * FROM users WHERE email = {email} AND status = {status}",
|
|
121
|
+
params={"email": "user@example.com", "status": "active"},
|
|
122
|
+
environment="production" # optional
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
print(response["data"])
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### Positional Parameters
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
response = client.db.execute_query(
|
|
132
|
+
query="SELECT * FROM users WHERE email = $1 AND status = $2",
|
|
133
|
+
params=["user@example.com", "active"]
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
print(response["data"])
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Insert Data
|
|
140
|
+
|
|
141
|
+
Insert single or multiple records into a table.
|
|
142
|
+
|
|
143
|
+
#### Single Record
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
response = client.db.insert(
|
|
147
|
+
table="users",
|
|
148
|
+
data={
|
|
149
|
+
"email": "newuser@example.com",
|
|
150
|
+
"name": "New User",
|
|
151
|
+
"status": "active"
|
|
152
|
+
}
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
print(response["data"])
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### Multiple Records
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
response = client.db.insert(
|
|
162
|
+
table="users",
|
|
163
|
+
data=[
|
|
164
|
+
{"email": "user1@example.com", "name": "User 1"},
|
|
165
|
+
{"email": "user2@example.com", "name": "User 2"}
|
|
166
|
+
]
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
print(f"Inserted {response['count']} records")
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Update Data
|
|
173
|
+
|
|
174
|
+
```python
|
|
175
|
+
response = client.db.update(
|
|
176
|
+
table="users",
|
|
177
|
+
data={"status": "inactive"},
|
|
178
|
+
where={"email": "user@example.com"}
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
print(f"Updated {response['count']} records")
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Delete Data
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
response = client.db.delete(
|
|
188
|
+
table="users",
|
|
189
|
+
where={"id": "123"}
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
print(response["message"])
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### List Tables
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
response = client.db.list_tables(environment="production", schema="public")
|
|
199
|
+
|
|
200
|
+
for table in response["tables"]:
|
|
201
|
+
print(table["table_name"])
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Get Table Schema
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
response = client.db.get_table_schema("users", environment="production")
|
|
208
|
+
|
|
209
|
+
print("Columns:", response["schema"]["columns"])
|
|
210
|
+
print("Indexes:", response["schema"]["indexes"])
|
|
211
|
+
print("Constraints:", response["schema"]["constraints"])
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Get Table Count
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
# Get total count
|
|
218
|
+
response = client.db.get_table_count("users")
|
|
219
|
+
print(f"Total users: {response['count']}")
|
|
220
|
+
|
|
221
|
+
# Get count with filters
|
|
222
|
+
response = client.db.get_table_count("users", filters={"status": "active"})
|
|
223
|
+
print(f"Active users: {response['count']}")
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Batch Operations
|
|
227
|
+
|
|
228
|
+
Execute multiple operations in a single transaction.
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
response = client.db.batch(
|
|
232
|
+
operations=[
|
|
233
|
+
{
|
|
234
|
+
"type": "insert",
|
|
235
|
+
"table": "users",
|
|
236
|
+
"data": {"email": "user1@example.com", "name": "User 1"}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"type": "update",
|
|
240
|
+
"table": "users",
|
|
241
|
+
"data": {"status": "active"},
|
|
242
|
+
"where": {"email": "user1@example.com"}
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"type": "query",
|
|
246
|
+
"query": "SELECT * FROM users WHERE email = $1",
|
|
247
|
+
"params": ["user1@example.com"]
|
|
248
|
+
}
|
|
249
|
+
],
|
|
250
|
+
transactional=True # All operations succeed or all fail
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
print(response["results"])
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
## Vector Search Operations
|
|
257
|
+
|
|
258
|
+
### Semantic Search
|
|
259
|
+
|
|
260
|
+
Perform semantic similarity search using vector embeddings.
|
|
261
|
+
|
|
262
|
+
#### Single Table Search
|
|
263
|
+
|
|
264
|
+
```python
|
|
265
|
+
response = client.db.semantic_search(
|
|
266
|
+
query="find products similar to wireless headphones",
|
|
267
|
+
table="products",
|
|
268
|
+
limit=10,
|
|
269
|
+
threshold=0.7,
|
|
270
|
+
filters={"category": "electronics"}
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
for result in response["results"]:
|
|
274
|
+
print(f"{result['record']['name']} - Similarity: {result['similarity']}")
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### Cross-Table Search
|
|
278
|
+
|
|
279
|
+
```python
|
|
280
|
+
response = client.db.semantic_search(
|
|
281
|
+
query="customer support issues",
|
|
282
|
+
tables=["tickets", "support_requests", "feedback"],
|
|
283
|
+
limit=20,
|
|
284
|
+
threshold=0.6
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
for result in response["results"]:
|
|
288
|
+
print(f"Table: {result['table']}, Similarity: {result['similarity']}")
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Hybrid Search
|
|
292
|
+
|
|
293
|
+
Combine semantic similarity with keyword search for better relevance.
|
|
294
|
+
|
|
295
|
+
```python
|
|
296
|
+
response = client.db.hybrid_search(
|
|
297
|
+
query="affordable wireless headphones",
|
|
298
|
+
table="products",
|
|
299
|
+
text_columns=["name", "description", "tags"],
|
|
300
|
+
semantic_weight=0.7,
|
|
301
|
+
keyword_weight=0.3,
|
|
302
|
+
limit=10
|
|
303
|
+
)
|
|
304
|
+
|
|
305
|
+
for result in response["results"]:
|
|
306
|
+
print(f"Combined Score: {result['combined_score']}")
|
|
307
|
+
print(f"Semantic: {result['semantic_score']}, Keyword: {result['keyword_score']}")
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
### Find Similar Records
|
|
311
|
+
|
|
312
|
+
Find records similar to a specific record.
|
|
313
|
+
|
|
314
|
+
```python
|
|
315
|
+
response = client.db.find_similar(
|
|
316
|
+
table="products",
|
|
317
|
+
record_id="123",
|
|
318
|
+
limit=5,
|
|
319
|
+
threshold=0.75,
|
|
320
|
+
exclude_self=True
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
print("Source Record:", response["source_record"])
|
|
324
|
+
for similar in response["similar_records"]:
|
|
325
|
+
print(f"{similar['record']['name']} - Similarity: {similar['similarity']}")
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## Workflow Operations
|
|
329
|
+
|
|
330
|
+
### Trigger a Workflow
|
|
331
|
+
|
|
332
|
+
```python
|
|
333
|
+
response = client.flows.trigger(
|
|
334
|
+
flow_id="your-flow-id",
|
|
335
|
+
input_data={
|
|
336
|
+
"key": "value",
|
|
337
|
+
"data": "your data here"
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
print(response)
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Trigger Workflow with File
|
|
345
|
+
|
|
346
|
+
#### Upload a file
|
|
347
|
+
|
|
348
|
+
```python
|
|
349
|
+
with open("/path/to/file.pdf", "rb") as f:
|
|
350
|
+
response = client.flows.trigger_with_file(
|
|
351
|
+
flow_id="your-flow-id",
|
|
352
|
+
file=f,
|
|
353
|
+
data={"note": "process this file"}
|
|
354
|
+
)
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
#### Download from URL
|
|
358
|
+
|
|
359
|
+
```python
|
|
360
|
+
response = client.flows.trigger_with_file(
|
|
361
|
+
flow_id="your-flow-id",
|
|
362
|
+
url="https://example.com/file.pdf",
|
|
363
|
+
data={"note": "process downloaded file"}
|
|
364
|
+
)
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### Get Workflow Metrics
|
|
368
|
+
|
|
369
|
+
```python
|
|
370
|
+
response = client.flows.get_metrics(
|
|
371
|
+
start_date="2024-01-01",
|
|
372
|
+
end_date="2024-02-01",
|
|
373
|
+
status="completed"
|
|
374
|
+
)
|
|
375
|
+
|
|
376
|
+
print(f"Total workflows: {response['metrics']['total_workflows']}")
|
|
377
|
+
print(f"Completed: {response['metrics']['completed_workflows']}")
|
|
378
|
+
print(f"Failed: {response['metrics']['failed_workflows']}")
|
|
379
|
+
print(f"Average duration: {response['metrics']['avg_duration_ms']}ms")
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
## Storage Operations
|
|
383
|
+
|
|
384
|
+
### Upload a File
|
|
385
|
+
|
|
386
|
+
```python
|
|
387
|
+
with open("/path/to/file.png", "rb") as f:
|
|
388
|
+
response = client.storage.upload(file=f, path="uploads/images")
|
|
389
|
+
|
|
390
|
+
print("File ID:", response["fileId"])
|
|
391
|
+
print("URL:", response["url"])
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
### Fetch a File
|
|
395
|
+
|
|
396
|
+
#### By File ID
|
|
397
|
+
|
|
398
|
+
```python
|
|
399
|
+
response = client.storage.fetch("file-id-123")
|
|
400
|
+
print("Download URL:", response["url"])
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
#### By File Path
|
|
404
|
+
|
|
405
|
+
```python
|
|
406
|
+
response = client.storage.fetch_by_path("uploads/images/1700000000000-file.png")
|
|
407
|
+
print("Download URL:", response["url"])
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### Delete a File
|
|
411
|
+
|
|
412
|
+
```python
|
|
413
|
+
response = client.storage.delete("file-id-123")
|
|
414
|
+
print(response["message"])
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
## Error Handling
|
|
418
|
+
|
|
419
|
+
The SDK provides specific exception classes for different error types.
|
|
420
|
+
|
|
421
|
+
```python
|
|
422
|
+
from worqhat import Worqhat, WorqhatError, APIError, AuthenticationError
|
|
423
|
+
|
|
424
|
+
client = Worqhat()
|
|
425
|
+
|
|
426
|
+
try:
|
|
427
|
+
response = client.db.execute_query(query="SELECT * FROM users")
|
|
428
|
+
except AuthenticationError as e:
|
|
429
|
+
print(f"Authentication failed: {e.message}")
|
|
430
|
+
except APIError as e:
|
|
431
|
+
print(f"API error: {e.message}")
|
|
432
|
+
print(f"Status code: {e.code}")
|
|
433
|
+
except WorqhatError as e:
|
|
434
|
+
print(f"General error: {e.message}")
|
|
435
|
+
```
|
|
436
|
+
|
|
437
|
+
### Exception Types
|
|
438
|
+
|
|
439
|
+
- `WorqhatError` - Base exception for all SDK errors
|
|
440
|
+
- `APIError` - Raised when the API returns an error response
|
|
441
|
+
- `AuthenticationError` - Raised when authentication fails
|
|
442
|
+
- `ValidationError` - Raised when request validation fails
|
|
443
|
+
- `NotFoundError` - Raised when a resource is not found
|
|
444
|
+
- `RateLimitError` - Raised when rate limit is exceeded
|
|
445
|
+
|
|
446
|
+
## Type Hints
|
|
447
|
+
|
|
448
|
+
The SDK includes full type hints for better IDE support and type checking.
|
|
449
|
+
|
|
450
|
+
```python
|
|
451
|
+
from worqhat import Worqhat
|
|
452
|
+
from typing import Dict, Any, List
|
|
453
|
+
|
|
454
|
+
client = Worqhat()
|
|
455
|
+
|
|
456
|
+
# Response is typed as Dict[str, Any]
|
|
457
|
+
response: Dict[str, Any] = client.db.execute_query(query="SELECT * FROM users")
|
|
458
|
+
|
|
459
|
+
# Access typed data
|
|
460
|
+
data: List[Dict[str, Any]] = response["data"]
|
|
461
|
+
execution_time: int = response["executionTime"]
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
## Advanced Usage
|
|
465
|
+
|
|
466
|
+
### Custom Timeout
|
|
467
|
+
|
|
468
|
+
```python
|
|
469
|
+
client = Worqhat(api_key="your-api-key", timeout=120) # 2 minutes
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
### Backend Target
|
|
473
|
+
|
|
474
|
+
```python
|
|
475
|
+
# Route to alternate backend
|
|
476
|
+
client = Worqhat(api_key="your-api-key", target="fyi")
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### Close Session Manually
|
|
480
|
+
|
|
481
|
+
```python
|
|
482
|
+
client = Worqhat()
|
|
483
|
+
try:
|
|
484
|
+
response = client.db.execute_query(query="SELECT * FROM users")
|
|
485
|
+
finally:
|
|
486
|
+
client.close()
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
## Examples
|
|
490
|
+
|
|
491
|
+
See the `examples/` directory for complete working examples:
|
|
492
|
+
|
|
493
|
+
- `basic_query.py` - Basic database queries
|
|
494
|
+
- `insert_update.py` - Insert and update operations
|
|
495
|
+
- `vector_search.py` - Semantic and hybrid search
|
|
496
|
+
- `workflows.py` - Workflow operations
|
|
497
|
+
- `storage.py` - File storage operations
|
|
498
|
+
|
|
499
|
+
## Requirements
|
|
500
|
+
|
|
501
|
+
- Python >= 3.8
|
|
502
|
+
- requests >= 2.31.0
|
|
503
|
+
|
|
504
|
+
## Development
|
|
505
|
+
|
|
506
|
+
### Install for Development
|
|
507
|
+
|
|
508
|
+
```bash
|
|
509
|
+
git clone https://github.com/worqhat/worqhat-python
|
|
510
|
+
cd worqhat-python
|
|
511
|
+
pip install -e ".[dev]"
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### Run Tests
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
pytest
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### Type Checking
|
|
521
|
+
|
|
522
|
+
```bash
|
|
523
|
+
mypy worqhat
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
### Code Formatting
|
|
527
|
+
|
|
528
|
+
```bash
|
|
529
|
+
black worqhat
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
## License
|
|
533
|
+
|
|
534
|
+
MIT
|
|
535
|
+
|
|
536
|
+
## Support
|
|
537
|
+
|
|
538
|
+
For API support, contact support@worqhat.com or visit [worqhat.com](https://worqhat.com).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
worqhat/__init__.py,sha256=hvVX_QpZk_9D6lLLqpmiCgW5_08R2vdG5guKkOyJKDY,298
|
|
2
|
+
worqhat/client.py,sha256=5CJYrdB0VTGCspxSassz0ZObVsg1V6M_P28Cqps2K3E,1858
|
|
3
|
+
worqhat/exceptions.py,sha256=TiOzwv-C-5AZ_qFBop3hool_m6_I8X0xKPPTSFlLR00,888
|
|
4
|
+
worqhat/http_client.py,sha256=Vf1lwKU8DeI1FKPwbWr5bmgqHUgKys-b4n53-7GOlVs,5025
|
|
5
|
+
worqhat/py.typed,sha256=8ZJUsxZiuOy1oJeVhsTWQhTG_6pTVHVXk5hJL79ebTk,25
|
|
6
|
+
worqhat/resources/__init__.py,sha256=hXb49_GKxT3pnMLoSC_8n6elmo3inyLTJ2BECOyiDBk,215
|
|
7
|
+
worqhat/resources/database.py,sha256=1yxrSXhSl3c9iqaZZEh-9VAXLfjuGvfP7ik_Abct2JE,8940
|
|
8
|
+
worqhat/resources/flows.py,sha256=ODXe2Gs8YOZvk7_rEzp-eRiJ3hM9x92RJ_NwFNrVeC4,2602
|
|
9
|
+
worqhat/resources/storage.py,sha256=LwgiMlD3fLsfRA7u930rPwA79erUkxp4T1uVKB7kP7g,1891
|
|
10
|
+
worqhat-4.1.0.dist-info/METADATA,sha256=Gpl8Ol-hL8K89QvWCBBd--cI5U5FERwKmcwmhdW-jTE,12286
|
|
11
|
+
worqhat-4.1.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
12
|
+
worqhat-4.1.0.dist-info/top_level.txt,sha256=7PUf-CeYyg_J3CpNHqxwUFB-rmC4F7Yote1-w3w4tfQ,8
|
|
13
|
+
worqhat-4.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
worqhat
|