Skip to content

osm2pgsql-replication init fails on get_dsn_parameters() #2040

@rustprooflabs

Description

@rustprooflabs

What version of osm2pgsql are you using?

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?

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 from the latest master branch.

What did you do exactly?

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 rustprooflabs/pgosm-flex#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?

I expect the osm2pgsql-replication init command to succeed.

What did happen instead?

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 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 fuction, while psycopg (3) does not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions