robosystems-client 0.2.2__py3-none-any.whl → 0.2.4__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.

Potentially problematic release.


This version of robosystems-client might be problematic. Click here for more details.

Files changed (121) hide show
  1. robosystems_client/api/agent/auto_select_agent.py +1 -41
  2. robosystems_client/api/agent/batch_process_queries.py +1 -41
  3. robosystems_client/api/agent/execute_specific_agent.py +1 -41
  4. robosystems_client/api/agent/get_agent_metadata.py +5 -49
  5. robosystems_client/api/agent/list_agents.py +4 -42
  6. robosystems_client/api/agent/recommend_agent.py +5 -45
  7. robosystems_client/api/auth/generate_sso_token.py +0 -18
  8. robosystems_client/api/auth/get_current_auth_user.py +14 -74
  9. robosystems_client/api/auth/logout_user.py +14 -50
  10. robosystems_client/api/auth/refresh_auth_session.py +14 -50
  11. robosystems_client/api/auth/resend_verification_email.py +14 -74
  12. robosystems_client/api/backup/create_backup.py +5 -45
  13. robosystems_client/api/backup/get_backup_download_url.py +4 -42
  14. robosystems_client/api/backup/get_backup_stats.py +5 -49
  15. robosystems_client/api/backup/list_backups.py +4 -42
  16. robosystems_client/api/backup/restore_backup.py +5 -45
  17. robosystems_client/api/connections/create_connection.py +5 -45
  18. robosystems_client/api/connections/create_link_token.py +5 -45
  19. robosystems_client/api/connections/delete_connection.py +5 -49
  20. robosystems_client/api/connections/exchange_link_token.py +5 -45
  21. robosystems_client/api/connections/get_connection.py +5 -49
  22. robosystems_client/api/connections/get_connection_options.py +5 -49
  23. robosystems_client/api/connections/init_o_auth.py +5 -45
  24. robosystems_client/api/connections/list_connections.py +4 -42
  25. robosystems_client/api/connections/oauth_callback.py +5 -45
  26. robosystems_client/api/connections/sync_connection.py +5 -45
  27. robosystems_client/api/graph_analytics/get_graph_metrics.py +5 -49
  28. robosystems_client/api/graph_analytics/get_graph_usage_stats.py +4 -42
  29. robosystems_client/api/graph_billing/get_current_graph_bill.py +5 -49
  30. robosystems_client/api/graph_billing/get_graph_billing_history.py +4 -42
  31. robosystems_client/api/graph_billing/get_graph_monthly_bill.py +5 -49
  32. robosystems_client/api/graph_billing/get_graph_usage_details.py +4 -42
  33. robosystems_client/api/graph_credits/check_credit_balance.py +0 -38
  34. robosystems_client/api/graph_credits/check_storage_limits.py +1 -45
  35. robosystems_client/api/graph_credits/get_credit_summary.py +1 -45
  36. robosystems_client/api/graph_credits/get_storage_usage.py +0 -38
  37. robosystems_client/api/graph_credits/list_credit_transactions.py +4 -42
  38. robosystems_client/api/graph_health/get_database_health.py +5 -49
  39. robosystems_client/api/graph_info/get_database_info.py +5 -49
  40. robosystems_client/api/graph_limits/get_graph_limits.py +5 -49
  41. robosystems_client/api/graphs/create_graph.py +21 -57
  42. robosystems_client/api/graphs/get_available_extensions.py +131 -15
  43. robosystems_client/api/graphs/get_graphs.py +154 -79
  44. robosystems_client/api/graphs/select_graph.py +117 -49
  45. robosystems_client/api/mcp/call_mcp_tool.py +24 -47
  46. robosystems_client/api/mcp/list_mcp_tools.py +13 -61
  47. robosystems_client/api/operations/cancel_operation.py +1 -45
  48. robosystems_client/api/operations/get_operation_status.py +1 -45
  49. robosystems_client/api/query/execute_cypher_query.py +68 -57
  50. robosystems_client/api/schema/export_graph_schema.py +223 -65
  51. robosystems_client/api/schema/get_graph_schema.py +137 -79
  52. robosystems_client/api/schema/validate_schema.py +5 -45
  53. robosystems_client/api/subgraphs/create_subgraph.py +5 -45
  54. robosystems_client/api/subgraphs/delete_subgraph.py +5 -45
  55. robosystems_client/api/subgraphs/get_subgraph_info.py +5 -49
  56. robosystems_client/api/subgraphs/get_subgraph_quota.py +5 -49
  57. robosystems_client/api/subgraphs/list_subgraphs.py +5 -49
  58. robosystems_client/api/tables/delete_file.py +317 -0
  59. robosystems_client/api/tables/get_file_info.py +249 -0
  60. robosystems_client/api/tables/get_upload_url.py +352 -0
  61. robosystems_client/api/tables/ingest_tables.py +428 -0
  62. robosystems_client/api/tables/list_table_files.py +329 -0
  63. robosystems_client/api/tables/list_tables.py +316 -0
  64. robosystems_client/api/tables/query_tables.py +431 -0
  65. robosystems_client/api/tables/update_file_status.py +395 -0
  66. robosystems_client/api/user/create_user_api_key.py +1 -41
  67. robosystems_client/api/user/get_all_credit_summaries.py +14 -111
  68. robosystems_client/api/user/get_current_user.py +14 -75
  69. robosystems_client/api/user/list_user_api_keys.py +14 -75
  70. robosystems_client/api/user/revoke_user_api_key.py +1 -45
  71. robosystems_client/api/user/update_user.py +1 -41
  72. robosystems_client/api/user/update_user_api_key.py +1 -41
  73. robosystems_client/api/user/update_user_password.py +1 -41
  74. robosystems_client/api/user_analytics/get_detailed_user_analytics.py +0 -38
  75. robosystems_client/api/user_analytics/get_user_usage_overview.py +14 -75
  76. robosystems_client/api/user_limits/get_all_shared_repository_limits.py +14 -105
  77. robosystems_client/api/user_limits/get_shared_repository_limits.py +1 -45
  78. robosystems_client/api/user_limits/get_user_limits.py +14 -75
  79. robosystems_client/api/user_limits/get_user_usage.py +14 -75
  80. robosystems_client/api/user_subscriptions/cancel_shared_repository_subscription.py +1 -45
  81. robosystems_client/api/user_subscriptions/get_repository_credits.py +1 -45
  82. robosystems_client/api/user_subscriptions/get_shared_repository_credits.py +14 -75
  83. robosystems_client/api/user_subscriptions/get_user_shared_subscriptions.py +0 -38
  84. robosystems_client/api/user_subscriptions/subscribe_to_shared_repository.py +1 -41
  85. robosystems_client/api/user_subscriptions/upgrade_shared_repository_subscription.py +1 -41
  86. robosystems_client/extensions/__init__.py +8 -1
  87. robosystems_client/extensions/auth_integration.py +1 -2
  88. robosystems_client/extensions/graph_client.py +5 -0
  89. robosystems_client/extensions/query_client.py +3 -2
  90. robosystems_client/extensions/sse_client.py +1 -1
  91. robosystems_client/extensions/table_ingest_client.py +36 -40
  92. robosystems_client/extensions/utils.py +2 -2
  93. robosystems_client/models/__init__.py +17 -21
  94. robosystems_client/models/create_graph_request.py +15 -3
  95. robosystems_client/models/cypher_query_request.py +5 -22
  96. robosystems_client/models/{delete_file_v1_graphs_graph_id_tables_files_file_id_delete_response_delete_file_v1_graphs_graph_id_tables_files_file_id_delete.py → delete_file_response.py} +45 -9
  97. robosystems_client/models/file_info.py +169 -0
  98. robosystems_client/models/file_status_update.py +41 -0
  99. robosystems_client/models/get_file_info_response.py +205 -0
  100. robosystems_client/models/list_table_files_response.py +105 -0
  101. robosystems_client/models/schema_export_response.py +4 -2
  102. robosystems_client/models/schema_info_response.py +77 -0
  103. robosystems_client/models/{get_graph_schema_response_getgraphschema.py → schema_info_response_schema.py} +6 -6
  104. robosystems_client/models/schema_validation_response.py +7 -6
  105. robosystems_client/models/table_query_request.py +37 -2
  106. robosystems_client/models/{get_file_info_v1_graphs_graph_id_tables_files_file_id_get_response_get_file_info_v1_graphs_graph_id_tables_files_file_id_get.py → update_file_status_response_updatefilestatus.py} +5 -8
  107. {robosystems_client-0.2.2.dist-info → robosystems_client-0.2.4.dist-info}/METADATA +2 -4
  108. {robosystems_client-0.2.2.dist-info → robosystems_client-0.2.4.dist-info}/RECORD +110 -108
  109. robosystems_client/api/tables/delete_file_v1_graphs_graph_id_tables_files_file_id_delete.py +0 -287
  110. robosystems_client/api/tables/get_file_info_v1_graphs_graph_id_tables_files_file_id_get.py +0 -283
  111. robosystems_client/api/tables/get_upload_url_v1_graphs_graph_id_tables_table_name_files_post.py +0 -260
  112. robosystems_client/api/tables/ingest_tables_v1_graphs_graph_id_tables_ingest_post.py +0 -251
  113. robosystems_client/api/tables/list_table_files_v1_graphs_graph_id_tables_table_name_files_get.py +0 -283
  114. robosystems_client/api/tables/list_tables_v1_graphs_graph_id_tables_get.py +0 -224
  115. robosystems_client/api/tables/query_tables_v1_graphs_graph_id_tables_query_post.py +0 -247
  116. robosystems_client/api/tables/update_file_v1_graphs_graph_id_tables_files_file_id_patch.py +0 -306
  117. robosystems_client/models/file_update_request.py +0 -62
  118. robosystems_client/models/list_table_files_v1_graphs_graph_id_tables_table_name_files_get_response_list_table_files_v1_graphs_graph_id_tables_table_name_files_get.py +0 -47
  119. robosystems_client/models/update_file_v1_graphs_graph_id_tables_files_file_id_patch_response_update_file_v1_graphs_graph_id_tables_files_file_id_patch.py +0 -47
  120. {robosystems_client-0.2.2.dist-info → robosystems_client-0.2.4.dist-info}/WHEEL +0 -0
  121. {robosystems_client-0.2.2.dist-info → robosystems_client-0.2.4.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,431 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.http_validation_error import HTTPValidationError
10
+ from ...models.table_query_request import TableQueryRequest
11
+ from ...models.table_query_response import TableQueryResponse
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ graph_id: str,
17
+ *,
18
+ body: TableQueryRequest,
19
+ ) -> dict[str, Any]:
20
+ headers: dict[str, Any] = {}
21
+
22
+ _kwargs: dict[str, Any] = {
23
+ "method": "post",
24
+ "url": f"/v1/graphs/{graph_id}/tables/query",
25
+ }
26
+
27
+ _kwargs["json"] = body.to_dict()
28
+
29
+ headers["Content-Type"] = "application/json"
30
+
31
+ _kwargs["headers"] = headers
32
+ return _kwargs
33
+
34
+
35
+ def _parse_response(
36
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
37
+ ) -> Optional[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]:
38
+ if response.status_code == 200:
39
+ response_200 = TableQueryResponse.from_dict(response.json())
40
+
41
+ return response_200
42
+
43
+ if response.status_code == 400:
44
+ response_400 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_400
47
+
48
+ if response.status_code == 401:
49
+ response_401 = cast(Any, None)
50
+ return response_401
51
+
52
+ if response.status_code == 403:
53
+ response_403 = ErrorResponse.from_dict(response.json())
54
+
55
+ return response_403
56
+
57
+ if response.status_code == 404:
58
+ response_404 = ErrorResponse.from_dict(response.json())
59
+
60
+ return response_404
61
+
62
+ if response.status_code == 408:
63
+ response_408 = cast(Any, None)
64
+ return response_408
65
+
66
+ if response.status_code == 422:
67
+ response_422 = HTTPValidationError.from_dict(response.json())
68
+
69
+ return response_422
70
+
71
+ if response.status_code == 500:
72
+ response_500 = cast(Any, None)
73
+ return response_500
74
+
75
+ if client.raise_on_unexpected_status:
76
+ raise errors.UnexpectedStatus(response.status_code, response.content)
77
+ else:
78
+ return None
79
+
80
+
81
+ def _build_response(
82
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
83
+ ) -> Response[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]:
84
+ return Response(
85
+ status_code=HTTPStatus(response.status_code),
86
+ content=response.content,
87
+ headers=response.headers,
88
+ parsed=_parse_response(client=client, response=response),
89
+ )
90
+
91
+
92
+ def sync_detailed(
93
+ graph_id: str,
94
+ *,
95
+ client: AuthenticatedClient,
96
+ body: TableQueryRequest,
97
+ ) -> Response[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]:
98
+ r"""Query Staging Tables with SQL
99
+
100
+ Execute SQL queries on DuckDB staging tables for data inspection and validation.
101
+
102
+ Query raw staging data directly with SQL before ingestion into the graph database.
103
+ Useful for data quality checks, validation, and exploratory analysis.
104
+
105
+ **Security Best Practice - Use Parameterized Queries:**
106
+ ALWAYS use query parameters instead of string concatenation to prevent SQL injection:
107
+ - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: [\"Company\", 100]`
108
+ - ❌ UNSAFE: `SELECT * FROM Entity WHERE type = 'Company' LIMIT 100` with user input concatenated
109
+ into SQL string
110
+
111
+ Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters
112
+ array.
113
+
114
+ **Use Cases:**
115
+ - Validate data quality before graph ingestion
116
+ - Inspect row-level data for debugging
117
+ - Run analytics on staging tables
118
+ - Check for duplicates, nulls, or data issues
119
+ - Preview data transformations
120
+
121
+ **Workflow:**
122
+ 1. Upload data files via `POST /tables/{table_name}/files`
123
+ 2. Query staging tables to validate: `POST /tables/query`
124
+ 3. Fix any data issues by re-uploading
125
+ 4. Ingest validated data: `POST /tables/ingest`
126
+
127
+ **Supported SQL:**
128
+ - Full DuckDB SQL syntax
129
+ - SELECT, JOIN, WHERE, GROUP BY, ORDER BY
130
+ - Aggregations, window functions, CTEs
131
+ - Multiple table joins across staging area
132
+
133
+ **Common Operations:**
134
+ - Count rows: `SELECT COUNT(*) FROM Entity`
135
+ - Filter by type: `SELECT * FROM Entity WHERE entity_type = ? LIMIT ?` with `parameters:
136
+ [\"Company\", 100]`
137
+ - Check for nulls: `SELECT * FROM Entity WHERE name IS NULL LIMIT 10`
138
+ - Find duplicates: `SELECT identifier, COUNT(*) as cnt FROM Entity GROUP BY identifier HAVING
139
+ COUNT(*) > 1`
140
+ - Filter amounts: `SELECT * FROM Transaction WHERE amount > ? AND date >= ?` with `parameters:
141
+ [1000, \"2024-01-01\"]`
142
+
143
+ **Limits:**
144
+ - Query timeout: 30 seconds
145
+ - Result limit: 10,000 rows (use LIMIT clause)
146
+ - Read-only: No INSERT, UPDATE, DELETE
147
+ - User's tables only: Cannot query other users' data
148
+
149
+ **Shared Repositories:**
150
+ Shared repositories (SEC, etc.) do not allow direct SQL queries.
151
+ Use the graph query endpoint instead: `POST /v1/graphs/{graph_id}/query`
152
+
153
+ **Note:**
154
+ Staging table queries are included - no credit consumption
155
+
156
+ Args:
157
+ graph_id (str):
158
+ body (TableQueryRequest):
159
+
160
+ Raises:
161
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
162
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
163
+
164
+ Returns:
165
+ Response[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]
166
+ """
167
+
168
+ kwargs = _get_kwargs(
169
+ graph_id=graph_id,
170
+ body=body,
171
+ )
172
+
173
+ response = client.get_httpx_client().request(
174
+ **kwargs,
175
+ )
176
+
177
+ return _build_response(client=client, response=response)
178
+
179
+
180
+ def sync(
181
+ graph_id: str,
182
+ *,
183
+ client: AuthenticatedClient,
184
+ body: TableQueryRequest,
185
+ ) -> Optional[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]:
186
+ r"""Query Staging Tables with SQL
187
+
188
+ Execute SQL queries on DuckDB staging tables for data inspection and validation.
189
+
190
+ Query raw staging data directly with SQL before ingestion into the graph database.
191
+ Useful for data quality checks, validation, and exploratory analysis.
192
+
193
+ **Security Best Practice - Use Parameterized Queries:**
194
+ ALWAYS use query parameters instead of string concatenation to prevent SQL injection:
195
+ - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: [\"Company\", 100]`
196
+ - ❌ UNSAFE: `SELECT * FROM Entity WHERE type = 'Company' LIMIT 100` with user input concatenated
197
+ into SQL string
198
+
199
+ Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters
200
+ array.
201
+
202
+ **Use Cases:**
203
+ - Validate data quality before graph ingestion
204
+ - Inspect row-level data for debugging
205
+ - Run analytics on staging tables
206
+ - Check for duplicates, nulls, or data issues
207
+ - Preview data transformations
208
+
209
+ **Workflow:**
210
+ 1. Upload data files via `POST /tables/{table_name}/files`
211
+ 2. Query staging tables to validate: `POST /tables/query`
212
+ 3. Fix any data issues by re-uploading
213
+ 4. Ingest validated data: `POST /tables/ingest`
214
+
215
+ **Supported SQL:**
216
+ - Full DuckDB SQL syntax
217
+ - SELECT, JOIN, WHERE, GROUP BY, ORDER BY
218
+ - Aggregations, window functions, CTEs
219
+ - Multiple table joins across staging area
220
+
221
+ **Common Operations:**
222
+ - Count rows: `SELECT COUNT(*) FROM Entity`
223
+ - Filter by type: `SELECT * FROM Entity WHERE entity_type = ? LIMIT ?` with `parameters:
224
+ [\"Company\", 100]`
225
+ - Check for nulls: `SELECT * FROM Entity WHERE name IS NULL LIMIT 10`
226
+ - Find duplicates: `SELECT identifier, COUNT(*) as cnt FROM Entity GROUP BY identifier HAVING
227
+ COUNT(*) > 1`
228
+ - Filter amounts: `SELECT * FROM Transaction WHERE amount > ? AND date >= ?` with `parameters:
229
+ [1000, \"2024-01-01\"]`
230
+
231
+ **Limits:**
232
+ - Query timeout: 30 seconds
233
+ - Result limit: 10,000 rows (use LIMIT clause)
234
+ - Read-only: No INSERT, UPDATE, DELETE
235
+ - User's tables only: Cannot query other users' data
236
+
237
+ **Shared Repositories:**
238
+ Shared repositories (SEC, etc.) do not allow direct SQL queries.
239
+ Use the graph query endpoint instead: `POST /v1/graphs/{graph_id}/query`
240
+
241
+ **Note:**
242
+ Staging table queries are included - no credit consumption
243
+
244
+ Args:
245
+ graph_id (str):
246
+ body (TableQueryRequest):
247
+
248
+ Raises:
249
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
250
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
251
+
252
+ Returns:
253
+ Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]
254
+ """
255
+
256
+ return sync_detailed(
257
+ graph_id=graph_id,
258
+ client=client,
259
+ body=body,
260
+ ).parsed
261
+
262
+
263
+ async def asyncio_detailed(
264
+ graph_id: str,
265
+ *,
266
+ client: AuthenticatedClient,
267
+ body: TableQueryRequest,
268
+ ) -> Response[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]:
269
+ r"""Query Staging Tables with SQL
270
+
271
+ Execute SQL queries on DuckDB staging tables for data inspection and validation.
272
+
273
+ Query raw staging data directly with SQL before ingestion into the graph database.
274
+ Useful for data quality checks, validation, and exploratory analysis.
275
+
276
+ **Security Best Practice - Use Parameterized Queries:**
277
+ ALWAYS use query parameters instead of string concatenation to prevent SQL injection:
278
+ - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: [\"Company\", 100]`
279
+ - ❌ UNSAFE: `SELECT * FROM Entity WHERE type = 'Company' LIMIT 100` with user input concatenated
280
+ into SQL string
281
+
282
+ Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters
283
+ array.
284
+
285
+ **Use Cases:**
286
+ - Validate data quality before graph ingestion
287
+ - Inspect row-level data for debugging
288
+ - Run analytics on staging tables
289
+ - Check for duplicates, nulls, or data issues
290
+ - Preview data transformations
291
+
292
+ **Workflow:**
293
+ 1. Upload data files via `POST /tables/{table_name}/files`
294
+ 2. Query staging tables to validate: `POST /tables/query`
295
+ 3. Fix any data issues by re-uploading
296
+ 4. Ingest validated data: `POST /tables/ingest`
297
+
298
+ **Supported SQL:**
299
+ - Full DuckDB SQL syntax
300
+ - SELECT, JOIN, WHERE, GROUP BY, ORDER BY
301
+ - Aggregations, window functions, CTEs
302
+ - Multiple table joins across staging area
303
+
304
+ **Common Operations:**
305
+ - Count rows: `SELECT COUNT(*) FROM Entity`
306
+ - Filter by type: `SELECT * FROM Entity WHERE entity_type = ? LIMIT ?` with `parameters:
307
+ [\"Company\", 100]`
308
+ - Check for nulls: `SELECT * FROM Entity WHERE name IS NULL LIMIT 10`
309
+ - Find duplicates: `SELECT identifier, COUNT(*) as cnt FROM Entity GROUP BY identifier HAVING
310
+ COUNT(*) > 1`
311
+ - Filter amounts: `SELECT * FROM Transaction WHERE amount > ? AND date >= ?` with `parameters:
312
+ [1000, \"2024-01-01\"]`
313
+
314
+ **Limits:**
315
+ - Query timeout: 30 seconds
316
+ - Result limit: 10,000 rows (use LIMIT clause)
317
+ - Read-only: No INSERT, UPDATE, DELETE
318
+ - User's tables only: Cannot query other users' data
319
+
320
+ **Shared Repositories:**
321
+ Shared repositories (SEC, etc.) do not allow direct SQL queries.
322
+ Use the graph query endpoint instead: `POST /v1/graphs/{graph_id}/query`
323
+
324
+ **Note:**
325
+ Staging table queries are included - no credit consumption
326
+
327
+ Args:
328
+ graph_id (str):
329
+ body (TableQueryRequest):
330
+
331
+ Raises:
332
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
333
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
334
+
335
+ Returns:
336
+ Response[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]
337
+ """
338
+
339
+ kwargs = _get_kwargs(
340
+ graph_id=graph_id,
341
+ body=body,
342
+ )
343
+
344
+ response = await client.get_async_httpx_client().request(**kwargs)
345
+
346
+ return _build_response(client=client, response=response)
347
+
348
+
349
+ async def asyncio(
350
+ graph_id: str,
351
+ *,
352
+ client: AuthenticatedClient,
353
+ body: TableQueryRequest,
354
+ ) -> Optional[Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]]:
355
+ r"""Query Staging Tables with SQL
356
+
357
+ Execute SQL queries on DuckDB staging tables for data inspection and validation.
358
+
359
+ Query raw staging data directly with SQL before ingestion into the graph database.
360
+ Useful for data quality checks, validation, and exploratory analysis.
361
+
362
+ **Security Best Practice - Use Parameterized Queries:**
363
+ ALWAYS use query parameters instead of string concatenation to prevent SQL injection:
364
+ - ✅ SAFE: `SELECT * FROM Entity WHERE type = ? LIMIT ?` with `parameters: [\"Company\", 100]`
365
+ - ❌ UNSAFE: `SELECT * FROM Entity WHERE type = 'Company' LIMIT 100` with user input concatenated
366
+ into SQL string
367
+
368
+ Query parameters provide automatic escaping and type safety. Use `?` placeholders with parameters
369
+ array.
370
+
371
+ **Use Cases:**
372
+ - Validate data quality before graph ingestion
373
+ - Inspect row-level data for debugging
374
+ - Run analytics on staging tables
375
+ - Check for duplicates, nulls, or data issues
376
+ - Preview data transformations
377
+
378
+ **Workflow:**
379
+ 1. Upload data files via `POST /tables/{table_name}/files`
380
+ 2. Query staging tables to validate: `POST /tables/query`
381
+ 3. Fix any data issues by re-uploading
382
+ 4. Ingest validated data: `POST /tables/ingest`
383
+
384
+ **Supported SQL:**
385
+ - Full DuckDB SQL syntax
386
+ - SELECT, JOIN, WHERE, GROUP BY, ORDER BY
387
+ - Aggregations, window functions, CTEs
388
+ - Multiple table joins across staging area
389
+
390
+ **Common Operations:**
391
+ - Count rows: `SELECT COUNT(*) FROM Entity`
392
+ - Filter by type: `SELECT * FROM Entity WHERE entity_type = ? LIMIT ?` with `parameters:
393
+ [\"Company\", 100]`
394
+ - Check for nulls: `SELECT * FROM Entity WHERE name IS NULL LIMIT 10`
395
+ - Find duplicates: `SELECT identifier, COUNT(*) as cnt FROM Entity GROUP BY identifier HAVING
396
+ COUNT(*) > 1`
397
+ - Filter amounts: `SELECT * FROM Transaction WHERE amount > ? AND date >= ?` with `parameters:
398
+ [1000, \"2024-01-01\"]`
399
+
400
+ **Limits:**
401
+ - Query timeout: 30 seconds
402
+ - Result limit: 10,000 rows (use LIMIT clause)
403
+ - Read-only: No INSERT, UPDATE, DELETE
404
+ - User's tables only: Cannot query other users' data
405
+
406
+ **Shared Repositories:**
407
+ Shared repositories (SEC, etc.) do not allow direct SQL queries.
408
+ Use the graph query endpoint instead: `POST /v1/graphs/{graph_id}/query`
409
+
410
+ **Note:**
411
+ Staging table queries are included - no credit consumption
412
+
413
+ Args:
414
+ graph_id (str):
415
+ body (TableQueryRequest):
416
+
417
+ Raises:
418
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
419
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
420
+
421
+ Returns:
422
+ Union[Any, ErrorResponse, HTTPValidationError, TableQueryResponse]
423
+ """
424
+
425
+ return (
426
+ await asyncio_detailed(
427
+ graph_id=graph_id,
428
+ client=client,
429
+ body=body,
430
+ )
431
+ ).parsed