vibespatial.io.postgis_gpu

GPU-accelerated PostGIS read/write via ADBC (Arrow Database Connectivity).

Pipeline:
read: ADBC → Arrow table → split WKB column → GPU decode → NativeTabularResult

→ GeoDataFrame

write: OwnedGeometryArray → GPU WKB encode → Arrow table → ADBC bulk ingest

ADBC is an OPTIONAL dependency. All public functions return None when ADBC is not installed, allowing the caller to fall back to the existing Shapely-based path transparently.

Functions

read_postgis_native(...)

Read a PostGIS query into a native tabular result using ADBC + GPU WKB decode.

read_postgis_gpu(→ vibespatial.api.GeoDataFrame | None)

Read a PostGIS query into a GeoDataFrame using ADBC + GPU WKB decode.

to_postgis_gpu(→ bool)

Write a GeoDataFrame to PostGIS using ADBC bulk ingest + GPU WKB encode.

Module Contents

vibespatial.io.postgis_gpu.read_postgis_native(sql: str, con: str | object, geom_col: str = 'geom', crs: str | int | None = None, chunksize: int | None = None) vibespatial.api._native_results.NativeTabularResult | None

Read a PostGIS query into a native tabular result using ADBC + GPU WKB decode.

Parameters

sqlstr

SQL query or table name.

constr or SQLAlchemy engine/connection

PostgreSQL connection URI (postgresql://...) or a SQLAlchemy connectable whose .url can be extracted.

geom_colstr

Name of the geometry column in the query result.

crsstr, int, or None

CRS to assign. If None, attempts auto-detection from PostGIS metadata (simple table queries only).

chunksizeint or None

Not yet supported for the GPU path. If set, returns None so the caller falls back to the Shapely chunked reader.

Returns

NativeTabularResult or None

None when ADBC is unavailable or any error occurs (caller should fall through to the Shapely-based path).

vibespatial.io.postgis_gpu.read_postgis_gpu(sql: str, con: str | object, geom_col: str = 'geom', crs: str | int | None = None, chunksize: int | None = None) vibespatial.api.GeoDataFrame | None

Read a PostGIS query into a GeoDataFrame using ADBC + GPU WKB decode.

vibespatial.io.postgis_gpu.to_postgis_gpu(gdf: vibespatial.api.GeoDataFrame | vibespatial.api._native_results.NativeTabularResult, name: str, con: str | object, if_exists: str = 'fail', schema: str | None = None, index: bool = False) bool

Write a GeoDataFrame to PostGIS using ADBC bulk ingest + GPU WKB encode.

Parameters

gdfGeoDataFrame

The data to write.

namestr

Target table name.

constr or SQLAlchemy engine/connection

PostgreSQL connection URI or a SQLAlchemy connectable.

if_existsstr

"fail", "replace", or "append".

schemastr or None

Database schema. Defaults to "public".

indexbool

Whether to write the DataFrame index as a column.

Returns

bool

True if the write succeeded via ADBC; False if the caller should fall back to the Shapely/GeoAlchemy2 path.