[Tile-serving] [openstreetmap/osm2pgsql] osm2pgsql-replication init fails on get_dsn_parameters() (Issue #2040)
Ryan Lambert
notifications at github.com
Wed Aug 16 00:43:47 UTC 2023
<!-- Please don't use screenshots. Copy and paste the *text* output here if that's needed for context. -->
## What version of osm2pgsql are you using?
<!-- Paste output of `osm2pgsql --version` here. Please use the [latest
release](https://osm2pgsql.org/releases/) of osm2pgsql if at all
possible. -->
```
2023-08-15 18:20:36 osm2pgsql version 1.9.0 (1.9.0)
Build: RelWithDebInfo
Compiled using the following library versions:
Libosmium 2.19.0
Proj [API 6] 7.2.1
Lua 5.4.2
```
## What operating system and PostgreSQL/PostGIS version are you using?
<!-- Also what Linux distribution if applicable, OS version? -->
Debian 11 (via the PostGIS 3.3 Docker image). Postgres 15.4, PostGIS 3.3.
`psycopg` versions seem to be relevant for this.
```
psycopg==3.1.10
psycopg-binary==3.1.10
```
## Tell us something about your system
Using the PgOSM Flex docker image, built starting from the Postgres 15 / PostGIS 3.3 Docker image. Overall it's a standard Debian build, installing pre-reqs and [installs osm2pgsql](https://github.com/rustprooflabs/pgosm-flex/blob/6e8d797a0cfd1cbc7ab898a516481e246fd02d9b/Dockerfile#L37-L48) from the latest `master` branch.
## What did you do exactly?
<!-- Please provide the command(s) you used including all options etc. Include
links to input files. -->
I was working on building a new Docker image for PgOSM Flex with the latest 1.9.0 release and the project's `make` command failed. Full details to reproduce how I found this are on https://github.com/rustprooflabs/pgosm-flex/issues/354.
The relevant failing command is:
```
osm2pgsql-replication init -d $PGOSM_CONN --osm-file /app/output/custom_source_file.osm.pbf
```
## What did you expect to happen?
<!-- Describe in detail what you expected the above would do. -->
I expect the `osm2pgsql-replication init` command to succeed.
## What did happen instead?
<!-- Please describe what happened and why you think this is wrong. Please include
(or link to, if it is too verbose) the log output. -->
The reported error is `AttributeError: 'Connection' object has no attribute 'get_dsn_parameters'`.
```
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:Traceback (most recent call last):
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:File "/usr/local/bin/osm2pgsql-replication", line 724, in <module>
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:sys.exit(main())
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:File "/usr/local/bin/osm2pgsql-replication", line 704, in main
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:with DBConnection(args) as db:
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:File "/usr/local/bin/osm2pgsql-replication", line 125, in __init__
2023-08-15 18:18:45,119:INFO:pgosm-flex:helpers:self.name = self.conn.get_dsn_parameters()['dbname']
2023-08-15 18:18:45,120:INFO:pgosm-flex:helpers:AttributeError: 'Connection' object has no attribute 'get_dsn_parameters'
2023-08-15 18:18:45,141:ERROR:pgosm-flex:pgosm_flex:Failed to run osm2pgsql-replication. Return code: 1
```
## What did you do to try analyzing the problem?
I found [this commit](https://github.com/openstreetmap/osm2pgsql/commit/6b489263004ea18b3b75ba9a579706f4847b4a56) that moved around code calling `conn.get_dsn_parameters()`. I noticed that originally it was within a `try` block, and doesn't appear to be in a `try` block now.
Using `psycopg` instead of `psycopg2` prompted me to check the two projects. `psycopg2` [has a `get_dsn_parameters`](https://github.com/search?q=repo%3Apsycopg%2Fpsycopg2%20get_dsn_parameters&type=code) fuction, while psycopg (3) [does not](https://github.com/search?q=repo%3Apsycopg%2Fpsycopg%20get_dsn_parameters&type=code).
<!-- Describe what steps you already did to try analyzing the problem before
reporting. -->
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/issues/2040
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/osm2pgsql/issues/2040 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20230815/e8f77a5d/attachment.htm>
More information about the Tile-serving
mailing list