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