Skip to content

refactor: PostgresCatalogSettings, simpler pg_get_collection_index and backend-specific geometry literal hooks - #313

Merged
vincentsarago merged 6 commits into
mainfrom
refactor/pg-catalog-settings
Nov 10, 2026
Merged

vincentsarago merged 6 commits into
mainfrom
refactor/pg-catalog-settings

Conversation

@vincentsarago

Copy link
Copy Markdown
Member

Note

Claude Code made this PR under the supervision of vincentsarago.

These changes were split out of #307 (DuckDB backend) so that PR only contains the DuckDB code. #307 is stacked on this branch.

Changes

  • DatabaseSettings → PostgresCatalogSettings (tipg.pg.settings, re-exported from tipg.pg). It keeps the TIPG_DB_ env prefix, so existing environment variables still work.
  • pg_get_collection_index(*, connection_pool, settings=None): it now acquires a connection from the pool itself, so callers no longer need async with pool.acquire() as conn.
  • tipg.main.register_collection_catalog(app, catalog_settings): catalog_settings is now required and replaces the db_settings option.
  • Geometry literal hooks: Collection._tag_geometry_literal / _reproject_geometry_literal are new abstract methods. They define how CQL2 / bbox / tile geometry literals get the geometry column CRS. PgCollection implements them with the same ST_SetSRID / ST_Transform calls as before, so the generated SQL is unchanged. This lets other backends (feat: add DuckDB backend #307) use their own functions.
  • _quote_ident moved from tipg.pg.collections to tipg.collections.
  • Docs:
    • the examples in customization.md, ogc_features_server.md and ogc_tiles_server.md and the class paths in configuration.md are updated;
    • the docs/src/api/tipg/pg/*.md pages now point to the right modules (they all rendered tipg.collections).
  • Notebook: examples/non_app_usage.ipynb is updated for the new tipg.pg API (adds IPython, jupyter and folium to the dev dependencies).

Breaking changes (listed in CHANGES.md)

DatabaseSettings rename, the pg_get_collection_index signature, the register_collection_catalog signature, and the new abstract methods that custom Collection subclasses must implement.

Testing

  • Full suite: 110 passed.
  • pre-commit run --all-files passes.
  • mypy -p tipg --ignore-missing-imports (CI command) passes.
  • The code examples in the updated doc pages were run against the test PostGIS database (not committed).

🤖 Generated with Claude Code

vincentsarago and others added 5 commits November 10, 2026 15:19
…kend

Add Collection._tag_geometry_literal / _reproject_geometry_literal hooks
(defaulting to the PostGIS ST_SetSRID / ST_Transform calls used today) and
move _quote_ident to tipg.collections so other backends can reuse them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collection._tag_geometry_literal / _reproject_geometry_literal no longer
default to PostGIS functions: each backend must define them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lify pg_get_collection_index

- tipg.pg.settings.DatabaseSettings → PostgresCatalogSettings (same TIPG_DB_ prefix)
- pg_get_collection_index(*, connection_pool, settings=None) acquires its own connection
- tipg.main.register_collection_catalog takes a required catalog_settings
- update docs, notebook (+ IPython/jupyter/folium dev deps) and tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vincentsarago
vincentsarago marked this pull request as ready for review November 10, 2026 14:29
@vincentsarago
vincentsarago merged commit c5f051f into main Nov 10, 2026
8 checks passed
@vincentsarago
vincentsarago deleted the refactor/pg-catalog-settings branch November 10, 2026 14:31
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