Skip to content

Release 0.1.34: %gpkg GeoPackage export, pushable with %dds (ref #309764) - #101

Merged
oskaresparza merged 9 commits into
mainfrom
staging
Oct 20, 2026
Merged

oskaresparza merged 9 commits into
mainfrom
staging

Conversation

@oskaresparza

Copy link
Copy Markdown
Collaborator

Promotes staging (0.1.34) to main. Ref #309764.

What's in it

  • %gpkg magic and geopackage package. It exports the tables and views under a Dremio catalog path (by default the %catalog use context) to a GeoPackage 1.4 file, written with pure-Python libraries (sqlite3, shapely, pyproj).
    • It works out which tables are spatial and which are plain tables.
    • When the geometry has no SRID, it takes the CRS from a CRS/SRID column.
    • Optional arguments: tables, limit, srid (reprojection, using definitions from epsg_definitions.json), filename, output_dir, overwrite, workers.
  • Streaming over Arrow Flight. Endpoints are read in parallel into a bounded queue, a pool of Flight channels shares one authentication, and a single SQLite writer thread does the inserts.
  • Progress. A line is printed for each table or view as it finishes or fails, then a total.
  • Push to DDS. report = %gpkg export() followed by %dds push(DELIVERABLES, report) works.
  • CI fix for the gpkg-to-DDS test, plus README, help text and notebook example.

Merged into staging through #100.

🤖 Generated with Claude Code

oskaresparza and others added 9 commits October 19, 2026 13:47
GpkgController exports the tables and views under a catalog path (default:
the %catalog use(...) context) to one .gpkg file, written with sqlite3,
shapely and pyproj (no GDAL):

- Spatial or tabular is decided per table from the data: a column holding
  WKB/EWKB, WKT/EWKT, hex WKB or GeoJSON, else latitude/longitude columns.
  Spatial tables become feature layers, the rest attribute tables.
- Each row's CRS comes from the geometry (EWKB/EWKT SRID), else a CRS column
  (srid, sr_id, epsg, crs, ...), else EPSG:4326 for latitude/longitude.
- Options: tables, limit per table, srid to reproject to, filename,
  output_dir (default <dataset>.gpkg next to the notebook), overwrite, workers.
- CRS definitions for reprojection and gpkg_spatial_ref_sys come from
  geopackage/epsg_definitions.json, falling back to pyproj's EPSG database.

Streaming: workers tables are read at once, each over its own Arrow Flight
gRPC channel, a batch at a time; workers decode, reproject and encode, and
one thread owns the SQLite file, fed through a bounded queue. The file is
built under a temporary name with no journal, in one transaction, and
renamed into place only when every table succeeded.

FlightSqlExecutor gains stream_batches (no overall deadline on reading,
parallel endpoints, cancel on early stop), fork() and thread-safe login;
Catalog gains stream_rows and open_flight_channel.

Also ignores *:Zone.Identifier download metadata.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redmine-Hook: v1
- export prints a line as each table/view is written (layer, source, kind,
  geometry type, SRS, rows, seconds, notes) or fails (naming the table and
  the error; the export then stops and no file is written), plus a start
  line and a total. GpkgController takes a progress callback (default: log
  only); the %gpkg session passes print. Each layer records its seconds.
- GpkgReport is os.PathLike (the written file), so
  `report = %gpkg export()` then `%dds push(DELIVERABLES, report)` uploads
  the .gpkg. .gpkg is registered as application/geopackage+sqlite3.
- %gpkg / %dds help and the README show both.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redmine-Hook: v1
Brings development up to date with staging (ingest PY-7 to PY-13,
%ingest diagnose / options / cleanup_on_failure, foldertree copy and move,
non-UTF-8 CSV check, the main ingest fix).

catalog/client.py conflicted only because both sides added to Catalog:
kept both — stream_rows / open_flight_channel (development) and
getentriesfrom / entryexists / getviewsql / createviewas / getfoldersfrom
and the foldertree imports (staging).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_a_gpkg_export_can_be_pushed_with_dds imported FakeSource from
tests.geopackage.conftest. That works under `python -m pytest` (the repo
root is on sys.path) but not under plain `pytest` as CI runs it, where
`tests` is not importable. The test now defines its own one-table source.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redmine-Hook: v1
debugger/test_catalog_magic.ipynb gains cells for %gpkg help, exporting a
dataset (limit=100) and pushing the result with %dds push(DELIVERABLES, ...).
The output.gpkg those cells write is git-ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Redmine-Hook: v1
%gpkg: stream Dremio tables and views to a GeoPackage, pushable with %dds (ref #309764)
@oskaresparza
oskaresparza merged commit ac9a116 into main Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant