Get Schema Information
Sprint 3
Get discovered schema information for a data source, including tables, columns, and metadata.
Endpoint
GET /api/v1/data-sources/{data_source_id}/schemas
Headers
| Header | Required | Description |
|---|---|---|
Authorization | Yes | Bearer <access_token> |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
data_source_id | integer | Yes | Data source ID |
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
schema_name | string | No | Filter by specific schema name |
table_name | string | No | Filter by specific table name |
include_columns | boolean | No | Include column details (default: true) |
Response
Success (200)
{
"success": true,
"data": {
"data_source_id": 1,
"schemas": [
{
"schema_name": "public",
"tables": [
{
"table_name": "users",
"table_type": "BASE TABLE",
"columns": [
{
"column_name": "id",
"column_type": "integer",
"column_position": 1,
"is_nullable": false,
"is_primary_key": true,
"is_foreign_key": false,
"default_value": "nextval('users_id_seq'::regclass)",
"column_comment": "User ID"
},
{
"column_name": "email",
"column_type": "varchar(255)",
"column_position": 2,
"is_nullable": false,
"is_primary_key": false,
"is_foreign_key": false,
"default_value": null,
"column_comment": "User email"
}
],
"row_count": 1250,
"discovered_at": "2024-12-01T09:00:00Z"
}
]
}
],
"last_discovered_at": "2024-12-01T09:00:00Z"
},
"message": "Schema information retrieved successfully"
}
Error Codes
| Status | Code | Description |
|---|---|---|
| 401 | UNAUTHORIZED | Invalid or missing authentication token |
| 403 | FORBIDDEN | User is not a member of any organization |
| 404 | NOT_FOUND | Data source not found |
Features
- Filter by schema name
- Filter by table name
- Optional column details (can exclude for faster response)
- Includes column metadata (types, constraints, comments)
- Row count information
- Organization-scoped access control
Example
curl -X GET "https://api.rivergen.com/api/v1/data-sources/1/schemas?schema_name=public&include_columns=true" \
-H "Authorization: Bearer <access_token>"
Related Endpoints
- Discover Schema - Discover and cache schema
- Get Data Source - Get data source details