forked from pgadmin-org/pgadmin4
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed an issue where servers listed in the servers.json file were bei…
…ng reimported upon container restart. pgadmin-org#7811
- Loading branch information
1 parent
e21911b
commit ed211a2
Showing
2 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
########################################################################## | ||
# | ||
# pgAdmin 4 - PostgreSQL Tools | ||
# | ||
# Copyright (C) 2013 - 2024, The pgAdmin Development Team | ||
# This software is released under the PostgreSQL Licence | ||
# | ||
########################################################################## | ||
|
||
from sqlalchemy import create_engine, inspect | ||
|
||
|
||
def check_external_config_db(database_uri): | ||
""" | ||
Check if external config database exists if it | ||
is being used. | ||
""" | ||
engine = create_engine(database_uri) | ||
try: | ||
connection = engine.connect() | ||
if inspect(engine).has_table("server"): | ||
return True | ||
return False | ||
except Exception: | ||
return False | ||
finally: | ||
connection.close() |