Connectors
Connectors API Endpoints.
This module provides the API endpoints for managing connectors and their associated documents. Connectors are used to ingest data from various sources (SQL, files, etc.).
create_connector(connector, service, current_user)
async
Create a new connector.
Parameters:
-
connector(ConnectorCreate) –The connector creation data.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
ConnectorResponse(ConnectorResponse) –The created connector.
Source code in app/api/v1/endpoints/connectors.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
create_connector_document(connector_id, document, service, current_user)
async
Manually add a document to a connector.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
document(ConnectorDocumentCreate) –The document creation data.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
ConnectorDocumentResponse(ConnectorDocumentResponse) –The created document.
Source code in app/api/v1/endpoints/connectors.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 | |
delete_connector(connector_id, service, current_user)
async
Delete a connector and its resources.
Parameters:
-
connector_id(UUID) –The ID of the connector to delete.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
Dict[str, str]–Dict[str, str]: A success message.
Source code in app/api/v1/endpoints/connectors.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
delete_document(connector_id, document_id, service, current_user)
async
Delete a specific document.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
document_id(UUID) –The ID of the document to delete.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
Dict[str, str]–Dict[str, str]: A success message.
Source code in app/api/v1/endpoints/connectors.py
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | |
get_connector_documents(connector_id, service, current_user, page=1, size=20, status=None, search=None)
async
Get paginated documents for a connector.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
-
page(int, default:1) –The page number.
-
size(int, default:20) –The page size.
-
status(Optional[DocStatus], default:None) –Filter by document status.
-
search(Optional[str], default:None) –Search term for file name or path.
Returns:
-
Dict[str, Any]–Dict[str, Any]: Paginated document results.
Source code in app/api/v1/endpoints/connectors.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | |
get_connectors(service, current_user)
async
List all connectors.
Parameters:
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
List[ConnectorResponse]–List[ConnectorResponse]: A list of all connectors.
Source code in app/api/v1/endpoints/connectors.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
scan_connector_files(connector_id, service, current_user)
async
Trigger manual file scan for a folder connector.
Parameters:
-
connector_id(UUID) –The ID of the connector to scan.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
ConnectorResponse(ConnectorResponse) –The connector being scanned.
Source code in app/api/v1/endpoints/connectors.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
stop_connector(connector_id, service, current_user)
async
Request to stop a running connector sync.
Parameters:
-
connector_id(UUID) –The ID of the connector to stop.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
ConnectorResponse(ConnectorResponse) –The connector being stopped.
Source code in app/api/v1/endpoints/connectors.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
stop_document(connector_id, document_id, service, current_user)
async
Request to stop re-sync for a single document.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
document_id(UUID) –The ID of the document to stop.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
Dict[str, str]–Dict[str, str]: A success message.
Source code in app/api/v1/endpoints/connectors.py
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | |
sync_connector(connector_id, service, current_user, force=False)
async
Trigger manual synchronization for a connector.
Parameters:
-
connector_id(UUID) –The ID of the connector to sync.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
-
force(bool, default:False) –Whether to force synchronization.
Returns:
-
ConnectorResponse(ConnectorResponse) –The connector being synced.
Source code in app/api/v1/endpoints/connectors.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
sync_document(connector_id, document_id, service, current_user)
async
Trigger re-sync for a single document.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
document_id(UUID) –The ID of the document to sync.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
Dict[str, str]–Dict[str, str]: A success message.
Source code in app/api/v1/endpoints/connectors.py
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
test_connection(payload, service, sql_discovery_service, current_user)
async
Test a connector connection (primarily for SQL).
Parameters:
-
payload(Dict[str, Any]) –Dictionary containing connector_type and configuration.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
sql_discovery_service(Annotated[Any, Depends(get_sql_discovery_service)]) –The SQL discovery service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
Dict[str, Any]–Dict[str, Any]: A success status and message.
Source code in app/api/v1/endpoints/connectors.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | |
train_vanna_connector(connector_id, payload, service, document_service, current_user)
async
Train Vanna AI on specific documents (tables/views) for vanna_sql connector.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
payload(Dict[str, Any]) –Dictionary containing
document_idslist. -
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
document_service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
Dict[str, Any]–Dict[str, Any]: A summary of the training results.
Source code in app/api/v1/endpoints/connectors.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
update_connector(connector_id, connector, service, current_user)
async
Update an existing connector.
Parameters:
-
connector_id(UUID) –The ID of the connector to update.
-
connector(ConnectorUpdate) –The connector update data.
-
service(Annotated[ConnectorService, Depends(get_connector_service)]) –The connector service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
ConnectorResponse(ConnectorResponse) –The updated connector.
Source code in app/api/v1/endpoints/connectors.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
update_document(connector_id, document_id, document, service, current_user)
async
Update a specific document.
Parameters:
-
connector_id(UUID) –The ID of the connector.
-
document_id(UUID) –The ID of the document to update.
-
document(ConnectorDocumentUpdate) –The document update data.
-
service(Annotated[DocumentService, Depends(get_document_service)]) –The document service instance.
-
current_user(Annotated[User, Depends(get_current_admin)]) –The currently authenticated admin user.
Returns:
-
ConnectorDocumentResponse(ConnectorDocumentResponse) –The updated document.
Source code in app/api/v1/endpoints/connectors.py
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |