Skip to content

Tables

The tables endpoints expose table discovery data from the Postgres-backed table cache and live health analysis from the PyIceberg catalog (Glue/S3).


List tables

GET /tables

Returns the current set of tables from the table cache. The cache is periodically refreshed by a background sync worker; see cache status to check freshness.

Query parameters

ParameterTypeDescription
databasestringFilter tables to a single database.
maintenance_enabledbooleanFilter by opt-in status (true or false).

Response — 200 OK

[
{
"database": "analytics",
"table_name": "page_views"
},
{
"database": "analytics",
"table_name": "sessions"
}
]

Each object contains:

FieldTypeDescription
databasestringDatabase name.
table_namestringTable name within the database.

Status codes

CodeMeaning
200Success.

Example

Terminal window
# All tables
curl https://snowpack-api.internal/tables
# Only tables in the "analytics" database that are opted in
curl "https://snowpack-api.internal/tables?database=analytics&maintenance_enabled=true"

Cache status

GET /tables/cache-status

Returns metadata about the table cache — when it was last refreshed and how many tables it contains. Useful for monitoring staleness.

Response — 200 OK

{
"last_synced": "2026-04-25T14:32:00.000000+00:00",
"table_count": 247
}
FieldTypeDescription
last_syncedstring | nullISO 8601 timestamp of the last successful sync, or null if never synced.
table_countintNumber of tables currently in the cache.

Status codes

CodeMeaning
200Success.

Example

Terminal window
curl https://snowpack-api.internal/tables/cache-status

Live table health

GET /tables/{database}/{table}/health

Performs a live health analysis by loading the table from the PyIceberg catalog (Glue/S3), inspecting its metadata, and computing file statistics, snapshot counts, and recommended maintenance actions. The result is also persisted to the health_snapshots Postgres table for future cached lookups.

This endpoint is slower than the cached variant (seconds vs. milliseconds) but always returns current data.

Path parameters

ParameterTypeDescription
databasestringDatabase name.
tablestringTable name.

Response — 200 OK

{
"table": {
"database": "analytics",
"table_name": "page_views",
"location": "s3://lakehouse/analytics/page_views",
"format_version": 2
},
"file_stats": {
"total_data_files": 1284,
"total_delete_files": 12,
"total_size_bytes": 53687091200,
"avg_file_size_bytes": 41812000,
"small_file_count": 87,
"small_file_pct": 6.78
},
"snapshot_count": 34,
"manifest_count": 18,
"recommended_actions": ["rewrite_data_files", "expire_snapshots"],
"needs_maintenance": true,
"maintenance_enabled": true,
"maintenance_cadence_hours": 24,
"snowpack_config": {
"maintenance_enabled": "true",
"maintenance_cadence_hours": "24"
},
"total_records": 5200000,
"snapshot_id": 7238461923847,
"hours_since_last_snapshot": 3.2,
"oldest_snapshot_age_hours": 168.5,
"health_status": "Degraded",
"error": null
}

Key response fields:

FieldTypeDescription
tableobjectTable identity and location.
file_statsobjectFile-level metrics (counts, sizes, small file percentage).
snapshot_countintTotal snapshots retained by the table.
manifest_countintNumber of manifest files in current metadata.
recommended_actionsstring[]Maintenance actions the analyzer recommends.
needs_maintenancebooleantrue when any metric exceeds its threshold.
maintenance_enabledboolean|nullValue of the snowpack.maintenance_enabled table property.
maintenance_cadence_hoursint|nullPer-table cadence override, if set.
snowpack_configobjectAll snowpack.* table properties as key-value pairs.
health_statusstringSummary label: Healthy, Degraded, or Unknown.
errorstring|nullNon-null if analysis encountered a non-fatal error.

Status codes

CodeMeaning
200Success.
404Table not found in the catalog.
422Invalid database or table name (identifier validation).
503Catalog unavailable or health analysis failed.

Example

Terminal window
curl https://snowpack-api.internal/tables/analytics/page_views/health

Cached table health

GET /tables/{database}/{table}/health/cached

Returns the most recent health_snapshots row from Postgres for the given table. This is the fast path — responses return in roughly 1 ms because no catalog or storage access is required.

Health snapshots are written by two sources:

  1. The live health endpoint (above) persists every successful analysis.
  2. The background health-sync worker periodically refreshes snapshots for all tables in configured databases.

Path parameters

ParameterTypeDescription
databasestringDatabase name.
tablestringTable name.

Response — 200 OK

Returns the full health snapshot object as stored in Postgres. The shape mirrors the live health response.

Status codes

CodeMeaning
200Success.
404No health snapshot exists for this table.
503Postgres unavailable.

Example

Terminal window
curl https://snowpack-api.internal/tables/analytics/page_views/health/cached