Use try except clause for establishing DB connection

pull/112/head
admire 2021-04-08 21:48:27 +02:00
rodzic 8d148685c9
commit 98a0c4bf91
1 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -216,8 +216,11 @@ class Enrich(object):
def check_database(self):
"""Test connection to PostGIS and create the URI."""
connection = self.create_connection()
cursor = connection.cursor()
try:
connection = self.create_connection()
cursor = connection.cursor()
except OperationalError as e:
print(e)
try:
for table, table_data in self.mapping_database_schema.items():
new_columns_postgis = []