Skip to content

Commit 2493d01

Browse files
committed
Remove deprecated API files and models related to file management and ingestion
This commit deletes several outdated modules and models from the API, including: - `delete_file.py`, `get_file_info.py`, `get_upload_url.py`, `ingest_tables.py`, `list_table_files.py`, and `update_file_status.py`. - Associated models such as `bulk_ingest_request`, `bulk_ingest_response`, and `table_ingest_result`. These removals aim to streamline the codebase and eliminate unused functionalities, enhancing maintainability and clarity in the API structure. No breaking changes are introduced as these files were previously marked for deprecation.
1 parent f23bae3 commit 2493d01

26 files changed

Lines changed: 2163 additions & 1531 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"""Contains endpoint functions for accessing the API"""

robosystems_client/api/tables/get_upload_url.py renamed to robosystems_client/api/files/create_file_upload.py

Lines changed: 61 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,14 @@
1414

1515
def _get_kwargs(
1616
graph_id: str,
17-
table_name: str,
1817
*,
1918
body: FileUploadRequest,
2019
) -> dict[str, Any]:
2120
headers: dict[str, Any] = {}
2221

2322
_kwargs: dict[str, Any] = {
2423
"method": "post",
25-
"url": f"/v1/graphs/{graph_id}/tables/{table_name}/files",
24+
"url": f"/v1/graphs/{graph_id}/files",
2625
}
2726

2827
_kwargs["json"] = body.to_dict()
@@ -65,10 +64,6 @@ def _parse_response(
6564

6665
return response_422
6766

68-
if response.status_code == 500:
69-
response_500 = cast(Any, None)
70-
return response_500
71-
7267
if client.raise_on_unexpected_status:
7368
raise errors.UnexpectedStatus(response.status_code, response.content)
7469
else:
@@ -88,57 +83,42 @@ def _build_response(
8883

8984
def sync_detailed(
9085
graph_id: str,
91-
table_name: str,
9286
*,
9387
client: AuthenticatedClient,
9488
body: FileUploadRequest,
9589
) -> Response[Any | ErrorResponse | FileUploadResponse | HTTPValidationError]:
96-
r"""Get File Upload URL
90+
"""Create File Upload
91+
92+
Generate presigned S3 URL for file upload.
9793
98-
Generate a presigned S3 URL for secure file upload.
94+
Initiate file upload by generating a secure, time-limited presigned S3 URL.
95+
Files are first-class resources uploaded directly to S3.
9996
100-
Initiates file upload to a staging table by generating a secure, time-limited
101-
presigned S3 URL. Files are uploaded directly to S3, bypassing the API for
102-
optimal performance.
97+
**Request Body:**
98+
- `file_name`: Name of the file (1-255 characters)
99+
- `file_format`: Format (parquet, csv, json)
100+
- `table_name`: Table to associate file with
103101
104102
**Upload Workflow:**
105103
1. Call this endpoint to get presigned URL
106104
2. PUT file directly to S3 URL
107-
3. Call PATCH /tables/files/{file_id} with status='uploaded'
108-
4. Backend validates file and calculates metrics
109-
5. File ready for ingestion
105+
3. Call PATCH /files/{file_id} with status='uploaded'
106+
4. Backend validates and stages in DuckDB immediately
107+
5. Background task ingests to graph
110108
111109
**Supported Formats:**
112-
- Parquet (`application/x-parquet` with `.parquet` extension)
113-
- CSV (`text/csv` with `.csv` extension)
114-
- JSON (`application/json` with `.json` extension)
115-
116-
**Validation:**
117-
- File extension must match content type
118-
- File name 1-255 characters
119-
- No path traversal characters (.. / \)
120-
- Auto-creates table if it doesn't exist
110+
- Parquet, CSV, JSON
121111
122112
**Auto-Table Creation:**
123-
Tables are automatically created on first file upload with type inferred from name
124-
(e.g., \"Transaction\" → relationship) and empty schema populated during ingestion.
125-
126-
**Subgraph Support:**
127-
This endpoint accepts both parent graph IDs and subgraph IDs.
128-
- Parent graph: Use `graph_id` like `kg0123456789abcdef`
129-
- Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
130-
Each subgraph has completely isolated S3 staging areas and tables. Files uploaded
131-
to one subgraph do not appear in other subgraphs.
113+
Tables are automatically created if they don't exist.
132114
133115
**Important Notes:**
134116
- Presigned URLs expire (default: 1 hour)
135-
- Use appropriate Content-Type header when uploading to S3
136-
- File extension must match content type
117+
- Files are graph-scoped, independent resources
137118
- Upload URL generation is included - no credit consumption
138119
139120
Args:
140121
graph_id (str):
141-
table_name (str): Table name
142122
body (FileUploadRequest):
143123
144124
Raises:
@@ -151,7 +131,6 @@ def sync_detailed(
151131

152132
kwargs = _get_kwargs(
153133
graph_id=graph_id,
154-
table_name=table_name,
155134
body=body,
156135
)
157136

@@ -164,57 +143,42 @@ def sync_detailed(
164143

165144
def sync(
166145
graph_id: str,
167-
table_name: str,
168146
*,
169147
client: AuthenticatedClient,
170148
body: FileUploadRequest,
171149
) -> Any | ErrorResponse | FileUploadResponse | HTTPValidationError | None:
172-
r"""Get File Upload URL
150+
"""Create File Upload
173151
174-
Generate a presigned S3 URL for secure file upload.
152+
Generate presigned S3 URL for file upload.
175153
176-
Initiates file upload to a staging table by generating a secure, time-limited
177-
presigned S3 URL. Files are uploaded directly to S3, bypassing the API for
178-
optimal performance.
154+
Initiate file upload by generating a secure, time-limited presigned S3 URL.
155+
Files are first-class resources uploaded directly to S3.
156+
157+
**Request Body:**
158+
- `file_name`: Name of the file (1-255 characters)
159+
- `file_format`: Format (parquet, csv, json)
160+
- `table_name`: Table to associate file with
179161
180162
**Upload Workflow:**
181163
1. Call this endpoint to get presigned URL
182164
2. PUT file directly to S3 URL
183-
3. Call PATCH /tables/files/{file_id} with status='uploaded'
184-
4. Backend validates file and calculates metrics
185-
5. File ready for ingestion
165+
3. Call PATCH /files/{file_id} with status='uploaded'
166+
4. Backend validates and stages in DuckDB immediately
167+
5. Background task ingests to graph
186168
187169
**Supported Formats:**
188-
- Parquet (`application/x-parquet` with `.parquet` extension)
189-
- CSV (`text/csv` with `.csv` extension)
190-
- JSON (`application/json` with `.json` extension)
191-
192-
**Validation:**
193-
- File extension must match content type
194-
- File name 1-255 characters
195-
- No path traversal characters (.. / \)
196-
- Auto-creates table if it doesn't exist
170+
- Parquet, CSV, JSON
197171
198172
**Auto-Table Creation:**
199-
Tables are automatically created on first file upload with type inferred from name
200-
(e.g., \"Transaction\" → relationship) and empty schema populated during ingestion.
201-
202-
**Subgraph Support:**
203-
This endpoint accepts both parent graph IDs and subgraph IDs.
204-
- Parent graph: Use `graph_id` like `kg0123456789abcdef`
205-
- Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
206-
Each subgraph has completely isolated S3 staging areas and tables. Files uploaded
207-
to one subgraph do not appear in other subgraphs.
173+
Tables are automatically created if they don't exist.
208174
209175
**Important Notes:**
210176
- Presigned URLs expire (default: 1 hour)
211-
- Use appropriate Content-Type header when uploading to S3
212-
- File extension must match content type
177+
- Files are graph-scoped, independent resources
213178
- Upload URL generation is included - no credit consumption
214179
215180
Args:
216181
graph_id (str):
217-
table_name (str): Table name
218182
body (FileUploadRequest):
219183
220184
Raises:
@@ -227,65 +191,49 @@ def sync(
227191

228192
return sync_detailed(
229193
graph_id=graph_id,
230-
table_name=table_name,
231194
client=client,
232195
body=body,
233196
).parsed
234197

235198

236199
async def asyncio_detailed(
237200
graph_id: str,
238-
table_name: str,
239201
*,
240202
client: AuthenticatedClient,
241203
body: FileUploadRequest,
242204
) -> Response[Any | ErrorResponse | FileUploadResponse | HTTPValidationError]:
243-
r"""Get File Upload URL
205+
"""Create File Upload
244206
245-
Generate a presigned S3 URL for secure file upload.
207+
Generate presigned S3 URL for file upload.
246208
247-
Initiates file upload to a staging table by generating a secure, time-limited
248-
presigned S3 URL. Files are uploaded directly to S3, bypassing the API for
249-
optimal performance.
209+
Initiate file upload by generating a secure, time-limited presigned S3 URL.
210+
Files are first-class resources uploaded directly to S3.
211+
212+
**Request Body:**
213+
- `file_name`: Name of the file (1-255 characters)
214+
- `file_format`: Format (parquet, csv, json)
215+
- `table_name`: Table to associate file with
250216
251217
**Upload Workflow:**
252218
1. Call this endpoint to get presigned URL
253219
2. PUT file directly to S3 URL
254-
3. Call PATCH /tables/files/{file_id} with status='uploaded'
255-
4. Backend validates file and calculates metrics
256-
5. File ready for ingestion
220+
3. Call PATCH /files/{file_id} with status='uploaded'
221+
4. Backend validates and stages in DuckDB immediately
222+
5. Background task ingests to graph
257223
258224
**Supported Formats:**
259-
- Parquet (`application/x-parquet` with `.parquet` extension)
260-
- CSV (`text/csv` with `.csv` extension)
261-
- JSON (`application/json` with `.json` extension)
262-
263-
**Validation:**
264-
- File extension must match content type
265-
- File name 1-255 characters
266-
- No path traversal characters (.. / \)
267-
- Auto-creates table if it doesn't exist
225+
- Parquet, CSV, JSON
268226
269227
**Auto-Table Creation:**
270-
Tables are automatically created on first file upload with type inferred from name
271-
(e.g., \"Transaction\" → relationship) and empty schema populated during ingestion.
272-
273-
**Subgraph Support:**
274-
This endpoint accepts both parent graph IDs and subgraph IDs.
275-
- Parent graph: Use `graph_id` like `kg0123456789abcdef`
276-
- Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
277-
Each subgraph has completely isolated S3 staging areas and tables. Files uploaded
278-
to one subgraph do not appear in other subgraphs.
228+
Tables are automatically created if they don't exist.
279229
280230
**Important Notes:**
281231
- Presigned URLs expire (default: 1 hour)
282-
- Use appropriate Content-Type header when uploading to S3
283-
- File extension must match content type
232+
- Files are graph-scoped, independent resources
284233
- Upload URL generation is included - no credit consumption
285234
286235
Args:
287236
graph_id (str):
288-
table_name (str): Table name
289237
body (FileUploadRequest):
290238
291239
Raises:
@@ -298,7 +246,6 @@ async def asyncio_detailed(
298246

299247
kwargs = _get_kwargs(
300248
graph_id=graph_id,
301-
table_name=table_name,
302249
body=body,
303250
)
304251

@@ -309,57 +256,42 @@ async def asyncio_detailed(
309256

310257
async def asyncio(
311258
graph_id: str,
312-
table_name: str,
313259
*,
314260
client: AuthenticatedClient,
315261
body: FileUploadRequest,
316262
) -> Any | ErrorResponse | FileUploadResponse | HTTPValidationError | None:
317-
r"""Get File Upload URL
263+
"""Create File Upload
318264
319-
Generate a presigned S3 URL for secure file upload.
265+
Generate presigned S3 URL for file upload.
320266
321-
Initiates file upload to a staging table by generating a secure, time-limited
322-
presigned S3 URL. Files are uploaded directly to S3, bypassing the API for
323-
optimal performance.
267+
Initiate file upload by generating a secure, time-limited presigned S3 URL.
268+
Files are first-class resources uploaded directly to S3.
269+
270+
**Request Body:**
271+
- `file_name`: Name of the file (1-255 characters)
272+
- `file_format`: Format (parquet, csv, json)
273+
- `table_name`: Table to associate file with
324274
325275
**Upload Workflow:**
326276
1. Call this endpoint to get presigned URL
327277
2. PUT file directly to S3 URL
328-
3. Call PATCH /tables/files/{file_id} with status='uploaded'
329-
4. Backend validates file and calculates metrics
330-
5. File ready for ingestion
278+
3. Call PATCH /files/{file_id} with status='uploaded'
279+
4. Backend validates and stages in DuckDB immediately
280+
5. Background task ingests to graph
331281
332282
**Supported Formats:**
333-
- Parquet (`application/x-parquet` with `.parquet` extension)
334-
- CSV (`text/csv` with `.csv` extension)
335-
- JSON (`application/json` with `.json` extension)
336-
337-
**Validation:**
338-
- File extension must match content type
339-
- File name 1-255 characters
340-
- No path traversal characters (.. / \)
341-
- Auto-creates table if it doesn't exist
283+
- Parquet, CSV, JSON
342284
343285
**Auto-Table Creation:**
344-
Tables are automatically created on first file upload with type inferred from name
345-
(e.g., \"Transaction\" → relationship) and empty schema populated during ingestion.
346-
347-
**Subgraph Support:**
348-
This endpoint accepts both parent graph IDs and subgraph IDs.
349-
- Parent graph: Use `graph_id` like `kg0123456789abcdef`
350-
- Subgraph: Use full subgraph ID like `kg0123456789abcdef_dev`
351-
Each subgraph has completely isolated S3 staging areas and tables. Files uploaded
352-
to one subgraph do not appear in other subgraphs.
286+
Tables are automatically created if they don't exist.
353287
354288
**Important Notes:**
355289
- Presigned URLs expire (default: 1 hour)
356-
- Use appropriate Content-Type header when uploading to S3
357-
- File extension must match content type
290+
- Files are graph-scoped, independent resources
358291
- Upload URL generation is included - no credit consumption
359292
360293
Args:
361294
graph_id (str):
362-
table_name (str): Table name
363295
body (FileUploadRequest):
364296
365297
Raises:
@@ -373,7 +305,6 @@ async def asyncio(
373305
return (
374306
await asyncio_detailed(
375307
graph_id=graph_id,
376-
table_name=table_name,
377308
client=client,
378309
body=body,
379310
)

0 commit comments

Comments
 (0)