When the connection url does not have an explicit driver, default to the provider driver - #2425
doublebyte1 wants to merge 4 commits into
Conversation
…ver instead of sqalchemy's default
tomkralidis
left a comment
There was a problem hiding this comment.
Thanks @doublebyte1. Can you fix flake8 errors in CI? Thanks.
|
Would the solution not be changing the driver_name in https://github.com/doublebyte1/pygeoapi/blob/0b3838011d54d01189f9cf937c557c4de35d41cb/pygeoapi/provider/sql.py#L810? Will also note that #2251 introduced full connection strings: |
That would be a solution, if everyone would use SQALchemy >=2.1. If someone is using an earlier version, than the driver would stil be psycog2. If we really want to be that specific, perhaps we should pin down SQAlchemy here? Line 17 in 0b38380 |
Overview
Currently, these are the versions being installed by the CI;
In SQAlchemy 2.1, the default driver changed to psycopg. However, pygeoapi is installing psycopg2. This mistmatch between what is installed, and the default driver that SQAlchemy expects, creates the issue described on #2424
This PR addresses the issue by letting the postgresql provider fallback to the backend provider driver. This approach avoids using the default SQAlchemy driver (which is not installed) and also pinning down dependencies.
A test was also added for creating a connection using the provider driver.
Related Issue / discussion
#2424
Additional information
Dependency policy (RFC2)
Updates to public demo
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)