worqhat 3.10.0__tar.gz → 4.2.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.
Files changed (142) hide show
  1. worqhat-4.2.0/PKG-INFO +538 -0
  2. worqhat-4.2.0/README.md +501 -0
  3. worqhat-4.2.0/pyproject.toml +62 -0
  4. worqhat-4.2.0/setup.cfg +4 -0
  5. worqhat-4.2.0/setup.py +43 -0
  6. worqhat-4.2.0/worqhat/__init__.py +11 -0
  7. worqhat-4.2.0/worqhat/client.py +62 -0
  8. worqhat-4.2.0/worqhat/exceptions.py +43 -0
  9. worqhat-4.2.0/worqhat/http_client.py +171 -0
  10. worqhat-4.2.0/worqhat/py.typed +1 -0
  11. worqhat-4.2.0/worqhat/resources/__init__.py +7 -0
  12. worqhat-4.2.0/worqhat/resources/database.py +293 -0
  13. worqhat-4.2.0/worqhat/resources/flows.py +95 -0
  14. worqhat-4.2.0/worqhat/resources/storage.py +72 -0
  15. worqhat-4.2.0/worqhat.egg-info/PKG-INFO +538 -0
  16. worqhat-4.2.0/worqhat.egg-info/SOURCES.txt +17 -0
  17. worqhat-4.2.0/worqhat.egg-info/dependency_links.txt +1 -0
  18. worqhat-4.2.0/worqhat.egg-info/requires.txt +12 -0
  19. worqhat-4.2.0/worqhat.egg-info/top_level.txt +1 -0
  20. worqhat-3.10.0/.gitignore +0 -15
  21. worqhat-3.10.0/.release-please-manifest.json +0 -3
  22. worqhat-3.10.0/CHANGELOG.md +0 -128
  23. worqhat-3.10.0/CONTRIBUTING.md +0 -128
  24. worqhat-3.10.0/LICENSE +0 -201
  25. worqhat-3.10.0/PKG-INFO +0 -432
  26. worqhat-3.10.0/README.md +0 -397
  27. worqhat-3.10.0/SECURITY.md +0 -27
  28. worqhat-3.10.0/api.md +0 -115
  29. worqhat-3.10.0/bin/check-release-environment +0 -21
  30. worqhat-3.10.0/bin/publish-pypi +0 -6
  31. worqhat-3.10.0/examples/.keep +0 -4
  32. worqhat-3.10.0/noxfile.py +0 -9
  33. worqhat-3.10.0/pyproject.toml +0 -267
  34. worqhat-3.10.0/release-please-config.json +0 -66
  35. worqhat-3.10.0/requirements-dev.lock +0 -137
  36. worqhat-3.10.0/requirements.lock +0 -75
  37. worqhat-3.10.0/src/worqhat/__init__.py +0 -92
  38. worqhat-3.10.0/src/worqhat/_base_client.py +0 -1995
  39. worqhat-3.10.0/src/worqhat/_client.py +0 -484
  40. worqhat-3.10.0/src/worqhat/_compat.py +0 -219
  41. worqhat-3.10.0/src/worqhat/_constants.py +0 -14
  42. worqhat-3.10.0/src/worqhat/_exceptions.py +0 -108
  43. worqhat-3.10.0/src/worqhat/_files.py +0 -123
  44. worqhat-3.10.0/src/worqhat/_models.py +0 -835
  45. worqhat-3.10.0/src/worqhat/_qs.py +0 -150
  46. worqhat-3.10.0/src/worqhat/_resource.py +0 -43
  47. worqhat-3.10.0/src/worqhat/_response.py +0 -830
  48. worqhat-3.10.0/src/worqhat/_streaming.py +0 -333
  49. worqhat-3.10.0/src/worqhat/_types.py +0 -260
  50. worqhat-3.10.0/src/worqhat/_utils/__init__.py +0 -64
  51. worqhat-3.10.0/src/worqhat/_utils/_compat.py +0 -45
  52. worqhat-3.10.0/src/worqhat/_utils/_datetime_parse.py +0 -136
  53. worqhat-3.10.0/src/worqhat/_utils/_logs.py +0 -25
  54. worqhat-3.10.0/src/worqhat/_utils/_proxy.py +0 -65
  55. worqhat-3.10.0/src/worqhat/_utils/_reflection.py +0 -42
  56. worqhat-3.10.0/src/worqhat/_utils/_resources_proxy.py +0 -24
  57. worqhat-3.10.0/src/worqhat/_utils/_streams.py +0 -12
  58. worqhat-3.10.0/src/worqhat/_utils/_sync.py +0 -86
  59. worqhat-3.10.0/src/worqhat/_utils/_transform.py +0 -457
  60. worqhat-3.10.0/src/worqhat/_utils/_typing.py +0 -156
  61. worqhat-3.10.0/src/worqhat/_utils/_utils.py +0 -421
  62. worqhat-3.10.0/src/worqhat/_version.py +0 -4
  63. worqhat-3.10.0/src/worqhat/lib/.keep +0 -4
  64. worqhat-3.10.0/src/worqhat/py.typed +0 -0
  65. worqhat-3.10.0/src/worqhat/resources/__init__.py +0 -61
  66. worqhat-3.10.0/src/worqhat/resources/db/__init__.py +0 -33
  67. worqhat-3.10.0/src/worqhat/resources/db/db.py +0 -1650
  68. worqhat-3.10.0/src/worqhat/resources/db/tables.py +0 -389
  69. worqhat-3.10.0/src/worqhat/resources/flows.py +0 -443
  70. worqhat-3.10.0/src/worqhat/resources/health.py +0 -143
  71. worqhat-3.10.0/src/worqhat/resources/storage.py +0 -462
  72. worqhat-3.10.0/src/worqhat/types/__init__.py +0 -44
  73. worqhat-3.10.0/src/worqhat/types/db/__init__.py +0 -10
  74. worqhat-3.10.0/src/worqhat/types/db/table_get_row_count_params.py +0 -12
  75. worqhat-3.10.0/src/worqhat/types/db/table_get_row_count_response.py +0 -15
  76. worqhat-3.10.0/src/worqhat/types/db/table_list_params.py +0 -15
  77. worqhat-3.10.0/src/worqhat/types/db/table_list_response.py +0 -26
  78. worqhat-3.10.0/src/worqhat/types/db/table_retrieve_schema_params.py +0 -12
  79. worqhat-3.10.0/src/worqhat/types/db/table_retrieve_schema_response.py +0 -29
  80. worqhat-3.10.0/src/worqhat/types/db_cluster_params.py +0 -27
  81. worqhat-3.10.0/src/worqhat/types/db_cluster_response.py +0 -44
  82. worqhat-3.10.0/src/worqhat/types/db_delete_records_params.py +0 -19
  83. worqhat-3.10.0/src/worqhat/types/db_delete_records_response.py +0 -18
  84. worqhat-3.10.0/src/worqhat/types/db_detect_anomalies_params.py +0 -24
  85. worqhat-3.10.0/src/worqhat/types/db_detect_anomalies_response.py +0 -50
  86. worqhat-3.10.0/src/worqhat/types/db_execute_batch_params.py +0 -36
  87. worqhat-3.10.0/src/worqhat/types/db_execute_batch_response.py +0 -27
  88. worqhat-3.10.0/src/worqhat/types/db_execute_query_params.py +0 -24
  89. worqhat-3.10.0/src/worqhat/types/db_execute_query_response.py +0 -21
  90. worqhat-3.10.0/src/worqhat/types/db_find_similar_params.py +0 -31
  91. worqhat-3.10.0/src/worqhat/types/db_find_similar_response.py +0 -30
  92. worqhat-3.10.0/src/worqhat/types/db_hybrid_search_params.py +0 -32
  93. worqhat-3.10.0/src/worqhat/types/db_hybrid_search_response.py +0 -48
  94. worqhat-3.10.0/src/worqhat/types/db_insert_record_params.py +0 -19
  95. worqhat-3.10.0/src/worqhat/types/db_insert_record_response.py +0 -15
  96. worqhat-3.10.0/src/worqhat/types/db_process_nl_query_params.py +0 -19
  97. worqhat-3.10.0/src/worqhat/types/db_process_nl_query_response.py +0 -18
  98. worqhat-3.10.0/src/worqhat/types/db_recommend_params.py +0 -33
  99. worqhat-3.10.0/src/worqhat/types/db_recommend_response.py +0 -36
  100. worqhat-3.10.0/src/worqhat/types/db_semantic_search_params.py +0 -33
  101. worqhat-3.10.0/src/worqhat/types/db_semantic_search_response.py +0 -36
  102. worqhat-3.10.0/src/worqhat/types/db_update_records_params.py +0 -22
  103. worqhat-3.10.0/src/worqhat/types/db_update_records_response.py +0 -18
  104. worqhat-3.10.0/src/worqhat/types/flow_get_metrics_params.py +0 -25
  105. worqhat-3.10.0/src/worqhat/types/flow_get_metrics_response.py +0 -55
  106. worqhat-3.10.0/src/worqhat/types/flow_trigger_with_file_params.py +0 -17
  107. worqhat-3.10.0/src/worqhat/types/flow_trigger_with_file_response.py +0 -18
  108. worqhat-3.10.0/src/worqhat/types/flow_trigger_with_payload_params.py +0 -13
  109. worqhat-3.10.0/src/worqhat/types/flow_trigger_with_payload_response.py +0 -20
  110. worqhat-3.10.0/src/worqhat/types/get_server_info_response.py +0 -15
  111. worqhat-3.10.0/src/worqhat/types/health_check_response.py +0 -33
  112. worqhat-3.10.0/src/worqhat/types/storage_delete_file_by_id_response.py +0 -18
  113. worqhat-3.10.0/src/worqhat/types/storage_retrieve_file_by_id_response.py +0 -33
  114. worqhat-3.10.0/src/worqhat/types/storage_retrieve_file_by_path_params.py +0 -12
  115. worqhat-3.10.0/src/worqhat/types/storage_retrieve_file_by_path_response.py +0 -33
  116. worqhat-3.10.0/src/worqhat/types/storage_upload_file_params.py +0 -17
  117. worqhat-3.10.0/src/worqhat/types/storage_upload_file_response.py +0 -33
  118. worqhat-3.10.0/tests/__init__.py +0 -1
  119. worqhat-3.10.0/tests/api_resources/__init__.py +0 -1
  120. worqhat-3.10.0/tests/api_resources/db/__init__.py +0 -1
  121. worqhat-3.10.0/tests/api_resources/db/test_tables.py +0 -306
  122. worqhat-3.10.0/tests/api_resources/test_client.py +0 -80
  123. worqhat-3.10.0/tests/api_resources/test_db.py +0 -1253
  124. worqhat-3.10.0/tests/api_resources/test_flows.py +0 -313
  125. worqhat-3.10.0/tests/api_resources/test_health.py +0 -80
  126. worqhat-3.10.0/tests/api_resources/test_storage.py +0 -351
  127. worqhat-3.10.0/tests/conftest.py +0 -84
  128. worqhat-3.10.0/tests/sample_file.txt +0 -1
  129. worqhat-3.10.0/tests/test_client.py +0 -1691
  130. worqhat-3.10.0/tests/test_deepcopy.py +0 -58
  131. worqhat-3.10.0/tests/test_extract_files.py +0 -64
  132. worqhat-3.10.0/tests/test_files.py +0 -51
  133. worqhat-3.10.0/tests/test_models.py +0 -963
  134. worqhat-3.10.0/tests/test_qs.py +0 -78
  135. worqhat-3.10.0/tests/test_required_args.py +0 -111
  136. worqhat-3.10.0/tests/test_response.py +0 -277
  137. worqhat-3.10.0/tests/test_streaming.py +0 -248
  138. worqhat-3.10.0/tests/test_transform.py +0 -460
  139. worqhat-3.10.0/tests/test_utils/test_datetime_parse.py +0 -110
  140. worqhat-3.10.0/tests/test_utils/test_proxy.py +0 -34
  141. worqhat-3.10.0/tests/test_utils/test_typing.py +0 -73
  142. worqhat-3.10.0/tests/utils.py +0 -167
worqhat-4.2.0/PKG-INFO ADDED
@@ -0,0 +1,538 @@
1
+ Metadata-Version: 2.4
2
+ Name: worqhat
3
+ Version: 4.2.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
+ [![PyPI version](https://badge.fury.io/py/worqhat.svg)](https://pypi.org/project/worqhat/)
41
+ [![CircleCI](https://circleci.com/gh/worqhat/worqhat-api.svg?style=shield)](https://circleci.com/gh/worqhat/worqhat-api)
42
+ [![Known Vulnerabilities](https://snyk.io/test/github/worqhat/worqhat-api/badge.svg?targetFile=python-sdk/pyproject.toml)](https://snyk.io/test/github/worqhat/worqhat-api?targetFile=python-sdk/pyproject.toml)
43
+ [![Security: bandit](https://img.shields.io/badge/security-bandit-yellow.svg)](https://github.com/PyCQA/bandit)
44
+ [![Python Versions](https://img.shields.io/pypi/pyversions/worqhat.svg)](https://pypi.org/project/worqhat/)
45
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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).