fix(provider): honour driver_name when a connection string omits the DBAPI - #2429
Open
C1-BA-B1-F3 wants to merge 3 commits into
Open
C1-BA-B1-F3 wants to merge 3 commits into
C1-BA-B1-F3 wants to merge 3 commits into
Conversation
PostgreSQL and MongoDB managers ignored the limit and offset parameters, returning all jobs regardless of the query string. Apply offset before limit in both backends, matching the existing TinyDB behaviour. Fixes geopython#2426
…ints The tilematrixsets and tilematrixset HTML handlers passed api.tpl_config as the template configuration, but that dict carries the full server config (including 'server') and lacks the 'path' key that render_j2_template expects. The lookup therefore always fell back to the default templates, ignoring any custom theme. Pass api.config['server']['templates'] instead, matching every other render_j2_template call site. Fixes geopython#2422
…DBAPI A provider configured with a bare connection string (e.g. "postgresql://user@host/db") resolved to SQLAlchemy's default DBAPI for that backend — psycopg (v3) for PostgreSQL. Deployments that only install psycopg2 then fail with 'ModuleNotFoundError: No module named psycopg' even though the provider pins 'postgresql+psycopg2'. When the caller's URL has no '+driver' suffix and the provider's driver_name does, rewrite the URL's drivername to the pinned one. Fixes geopython#2424
Contributor
Author
|
The |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A provider configured with a bare connection string:
resolves to SQLAlchemy's default DBAPI for the backend —
psycopg(v3) for PostgreSQL. Deployments that only installpsycopg2(perrequirements-provider.txt) then fail at engine creation:even though
PostgreSQLProvider.__init__pinsdriver_name='postgresql+psycopg2'. The pin is silently ignored wheneverdatais a string, becausestore_db_parametersroutes it toself.db_connandget_engineuses the URL verbatim.The CI failure in
tests/provider/test_postgresql_provider(andtest_api_connection_rfc3986in the manager suite, which also builds its connection string with a barepostgresql://URL) is exactly this.Fix
In
get_engine, when the caller's URL has no+driversuffix and the provider'sdriver_namedoes, rewrite the URL'sdrivernameto the pinned one. Explicitly-pinned URLs (postgresql+psycopg://...) are untouched.Test plan
create_engine:postgresql://…+ pinpostgresql+psycopg2→ engine URL becomespostgresql+psycopg2postgresql+psycopg://…→ untouchedconn_str→ built fromdriver_nameas beforetest_api_connection_rfc3986now reaches the real connection attempt (psycopg2.OperationalError: connection refusedlocally) instead of failing atimport psycopg, confirming the v2 driver is selected.Fixes #2424