mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-16 10:15:24 -06:00
Added exception handling for SQLAlchemy function to check the table exists or not.
This commit is contained in:
parent
b0727cc532
commit
5768ade198
@ -21,8 +21,8 @@ class SetSessionExpirationTimeTestCase(BaseTestGenerator):
|
||||
|
||||
scenarios = [
|
||||
(
|
||||
'TestCase for verifying session expire time is set to {0} days for '
|
||||
'desktop mode'.format(SESSION_EXP_TIME_DESKTOP),
|
||||
'TestCase for verifying session expire time is set to {0} days '
|
||||
'for desktop mode'.format(SESSION_EXP_TIME_DESKTOP),
|
||||
dict(
|
||||
session_expiration_time=SESSION_EXP_TIME_DESKTOP,
|
||||
is_desktop_mode=True
|
||||
|
@ -7,7 +7,6 @@
|
||||
#
|
||||
##########################################################################
|
||||
|
||||
from pgadmin.model import Version
|
||||
from pgadmin.model import db
|
||||
|
||||
|
||||
@ -22,9 +21,14 @@ def check_db_tables():
|
||||
db_table_names = get_db_table_names()
|
||||
# check table is actually present in the db.
|
||||
for table_name in db_table_names:
|
||||
if not db.engine.dialect.has_table(db.engine, table_name):
|
||||
invalid_tb_names.append(table_name)
|
||||
is_error = True
|
||||
try:
|
||||
if not db.inspect(db.engine).has_table(table_name=table_name):
|
||||
invalid_tb_names.append(table_name)
|
||||
is_error = True
|
||||
except AttributeError:
|
||||
if not db.engine.dialect.has_table(db.engine, table_name):
|
||||
invalid_tb_names.append(table_name)
|
||||
is_error = True
|
||||
|
||||
if is_error:
|
||||
return True, invalid_tb_names
|
||||
|
Loading…
Reference in New Issue
Block a user