Skip to main content

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

HeaderRequiredDescription
AuthorizationYesBearer <access_token>

Path Parameters

ParameterTypeRequiredDescription
data_source_idintegerYesData source ID

Query Parameters

ParameterTypeRequiredDescription
schema_namestringNoFilter by specific schema name
table_namestringNoFilter by specific table name
include_columnsbooleanNoInclude 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

StatusCodeDescription
401UNAUTHORIZEDInvalid or missing authentication token
403FORBIDDENUser is not a member of any organization
404NOT_FOUNDData 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>"