Skip to content

Commit 25a1e9d

Browse files
lonviajoto
authored andcommitted
replication script: enable psycopg3
1 parent d7291e4 commit 25a1e9d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

scripts/osm2pgsql-replication

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ import urllib.request as urlrequest
3333
missing_modules = []
3434

3535
try:
36-
import psycopg2
36+
import psycopg2 as psycopg
3737
except ImportError:
38-
missing_modules.append('psycopg2')
38+
try:
39+
import psycopg
40+
except ImportError:
41+
missing_modules.append('psycopg2')
3942

4043
try:
4144
from osmium.replication.server import ReplicationServer
@@ -72,8 +75,8 @@ def pretty_format_timedelta(seconds):
7275
def connect(args):
7376
""" Create a connection from the given command line arguments.
7477
"""
75-
return psycopg2.connect(dbname=args.database, user=args.username,
76-
host=args.host, port=args.port)
78+
return psycopg.connect(dbname=args.database, user=args.username,
79+
host=args.host, port=args.port)
7780

7881

7982
def compute_database_date(conn, prefix):

0 commit comments

Comments
 (0)