pypgstac
Schema, functions and a python library for storing and accessing STAC collections and items in PostgreSQL
What it is and what it does
pypgstac is a Python library for interacting with STAC (Spatio-Temporal Asset Catalog) data stored in PostgreSQL. It provides schema management, search utilities, and integration with PostgreSQL's spatial capabilities to build performant catalogs of geospatial and temporal metadata. The package is part of a larger ecosystem that includes SQL schema definitions, a Rust CLI, and migration tools—but pypgstac itself focuses on the Python read/write layer.
The library is designed to work alongside PostgreSQL drivers and is typically used in production deployments where STAC catalogs need to scale to hundreds of millions of items. It does not expose an HTTP API directly; instead, it serves as a backend for frameworks like STAC FastAPI or other applications that need programmatic access to STAC collections and items stored in a PostgreSQL database.
Use it for:
- Query and filter STAC collections and items from a PostgreSQL database using CQL2 search syntax
- Manage indexing and partitioning of large STAC catalogs in production environments
- Build custom STAC API backends by integrating pypgstac with web frameworks
- Migrate or maintain STAC data stored in PostgreSQL with schema utilities
- Integrate geospatial asset metadata into Python applications backed by PostgreSQL
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
pypgstac provides Python bindings and utilities for managing Spatio-Temporal Asset Catalog (STAC) data in PostgreSQL, including search, filtering, and schema management functions.
Yes, if you are building or maintaining a STAC catalog in PostgreSQL and need Python access to query and manage it. The package is actively maintained, has no known vulnerabilities, and low install friction. Not necessary if you only need HTTP-level STAC API access or are not using PostgreSQL as your backend.
Install
pypgstac on PyPI
pip
pip install pypgstacuv
uv add pypgstacpoetry
poetry add pypgstacInstalling pypgstac
Before you install
Low friction installation with a pure-Python wheel. Active maintenance: released 15 days ago with a last commit on 2026-08-10. Depends on 10 runtime packages including pydantic, orjson, and tenacity—all common, stable dependencies.
License in practice
MIT license (permissive) allows use in commercial and proprietary projects with minimal restrictions beyond attribution.
Quickstart
pip install pypgstac
import pypgstac
from pydantic import BaseModel
# Use pypgstac with PostgreSQL connection to query STAC items
Requires a PostgreSQL database with PgSTAC schema installed; pypgstac is a Python client library, not a standalone database.
Verify before relying
- Specific API surface and method signatures available in version 0.9.12
- Whether pypgstac-rs (Rust-backed extension) is included or requires separate installation
- Performance characteristics when querying hundreds of millions of STAC items
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 10 — cachetools, fire, hydraters, orjson, plpygis, pydantic, python-dateutil, smart-open, tenacity, version-parser |
| Maintenance | actively maintained — 15 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 138,382/month — #11,329 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pypgstac-0.9.12-py3-none-any.whl
Keywords: PgSTAC, Postgresql, STAC
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
stac-fastapi-pgstacProvides a FastAPI-based HTTP interface to…
permissive · top 15,000 on PyPI
pystacPySTAC is a Python library for reading,…
permissive · top 5,000 on PyPI
stac-fastapi-extensionsProvides FastAPI extensions for the STAC API…
permissive · top 15,000 on PyPI
stac-fastapi-apiProvides a FastAPI-based implementation of the…
permissive · top 15,000 on PyPI
pystac-clientPySTAC Client is a Python library for querying…
permissive · top 15,000 on PyPI
pystac-corePySTAC Core provides the foundational API for…
permissive · top 5,000 on PyPI
stac-fastapi-typesProvides core type definitions and data models…
permissive · top 15,000 on PyPI
odc-stacConverts STAC (SpatialTemporal Asset Catalog)…
unclear · top 15,000 on PyPI
stac-pydanticProvides Pydantic models for validating and…
permissive · top 15,000 on PyPI
arcosparseDownloads and subsets sparse geospatial…
unclear · top 15,000 on PyPI