Skip to content

Commit f3e933c

Browse files
committed
fix: add pre ping to create_engine call
1 parent f7f0c2b commit f3e933c

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

indexd/default_settings.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,22 @@
1515
"driver": SQLAlchemyIndexDriver(
1616
PG_URL,
1717
auto_migrate=AUTO_MIGRATE,
18-
echo=SQLALCHEMY_VERBOSE,
18+
# echo=SQLALCHEMY_VERBOSE,
1919
index_config={
2020
"DEFAULT_PREFIX": "testprefix:",
2121
"ADD_PREFIX_ALIAS": True,
2222
"PREPEND_PREFIX": True,
2323
},
24-
pool_pre_ping=True,
24+
# pool_pre_ping=True,
2525
),
2626
}
2727

2828
CONFIG["ALIAS"] = {
2929
"driver": SQLAlchemyAliasDriver(
30-
PG_URL, auto_migrate=AUTO_MIGRATE, echo=SQLALCHEMY_VERBOSE, pool_pre_ping=True
30+
PG_URL,
31+
auto_migrate=AUTO_MIGRATE,
32+
# echo=SQLALCHEMY_VERBOSE,
33+
# pool_pre_ping=True
3134
),
3235
}
3336

@@ -52,6 +55,9 @@
5255
},
5356
]
5457

55-
AUTH = SQLAlchemyAuthDriver(PG_URL, pool_pre_ping=True)
58+
AUTH = SQLAlchemyAuthDriver(
59+
PG_URL,
60+
# pool_pre_ping=True
61+
)
5662

5763
settings = {"config": CONFIG, "auth": AUTH}

indexd/driver_base.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44

55
Base = declarative_base()
66

7+
78
class SQLAlchemyDriverBase(object):
8-
'''
9+
"""
910
SQLAlchemy implementation of index driver.
10-
'''
11+
"""
1112

1213
def __init__(self, conn, **config):
13-
'''
14+
"""
1415
Initialize the SQLAlchemy database driver.
15-
'''
16-
engine = create_engine(conn, **config)
16+
"""
17+
engine = create_engine(conn, **config, pool_pre_ping=True, echo=True)
1718
if not database_exists(engine.url):
1819
create_database(engine.url)
1920
self.engine = engine

0 commit comments

Comments
 (0)