Replace the generic exception class with a more specific one to fix SonarQube issues.
parent
d2621282dc
commit
aa679e06b2
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ExecuteError
|
||||||
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
|
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
|
||||||
import DataTypeReader
|
import DataTypeReader
|
||||||
from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
|
from pgadmin.browser.server_groups.servers.utils import parse_priv_from_db, \
|
||||||
|
@ -52,7 +52,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -211,7 +211,7 @@ def get_formatted_columns(conn, tid, data, other_columns,
|
||||||
|
|
||||||
status, res = conn.execute_dict(SQL)
|
status, res = conn.execute_dict(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
all_columns = res['rows']
|
all_columns = res['rows']
|
||||||
edit_types = {}
|
edit_types = {}
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
|
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
|
||||||
import trigger_definition
|
import trigger_definition
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
@ -50,7 +50,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -105,7 +105,7 @@ def get_sql(conn, data, tid, trid, datlastsysoid, template_path=None):
|
||||||
|
|
||||||
status, res = conn.execute_dict(sql)
|
status, res = conn.execute_dict(sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
elif len(res['rows']) == 0:
|
elif len(res['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
_('Could not find the compound trigger in the table.'))
|
_('Could not find the compound trigger in the table.'))
|
||||||
|
@ -162,7 +162,7 @@ def get_reverse_engineered_sql(conn, **kwargs):
|
||||||
|
|
||||||
status, res = conn.execute_dict(SQL)
|
status, res = conn.execute_dict(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -163,7 +163,7 @@ def get_sql(conn, data, tid, cid=None, template_path=None):
|
||||||
tid=tid, cid=cid)
|
tid=tid, cid=cid)
|
||||||
status, res = conn.execute_dict(sql)
|
status, res = conn.execute_dict(sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -191,7 +191,7 @@ def get_sql(conn, data, did, tid, exid=None, template_path=None):
|
||||||
did=did, tid=tid, cid=exid)
|
did=did, tid=tid, cid=exid)
|
||||||
status, res = conn.execute_dict(sql)
|
status, res = conn.execute_dict(sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ def search_coveringindex(conn, tid, cols, template_path=None):
|
||||||
tid=tid)
|
tid=tid)
|
||||||
status, constraints = conn.execute_dict(SQL)
|
status, constraints = conn.execute_dict(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(constraints)
|
raise ExecuteError(constraints)
|
||||||
|
|
||||||
for constraint in constraints['rows']:
|
for constraint in constraints['rows']:
|
||||||
sql = render_template(
|
sql = render_template(
|
||||||
|
@ -120,7 +120,7 @@ def search_coveringindex(conn, tid, cols, template_path=None):
|
||||||
status, rest = conn.execute_dict(sql)
|
status, rest = conn.execute_dict(sql)
|
||||||
|
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rest)
|
raise ExecuteError(rest)
|
||||||
|
|
||||||
index_cols = set()
|
index_cols = set()
|
||||||
for r in rest['rows']:
|
for r in rest['rows']:
|
||||||
|
@ -146,7 +146,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -254,7 +254,7 @@ def get_sql(conn, data, tid, fkid=None, template_path=None):
|
||||||
|
|
||||||
status, res = conn.execute_dict(col_sql)
|
status, res = conn.execute_dict(col_sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
columns = []
|
columns = []
|
||||||
for row in res['rows']:
|
for row in res['rows']:
|
||||||
|
@ -290,7 +290,7 @@ def _get_properties_for_fk_const(tid, fkid, data, template_path, conn):
|
||||||
tid=tid, cid=fkid)
|
tid=tid, cid=fkid)
|
||||||
status, res = conn.execute_dict(sql)
|
status, res = conn.execute_dict(sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -195,7 +195,7 @@ def get_sql(conn, data, did, tid, ctype, cid=None, template_path=None):
|
||||||
constraint_type=ctype)
|
constraint_type=ctype)
|
||||||
status, res = conn.execute_dict(sql)
|
status, res = conn.execute_dict(sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -290,7 +290,7 @@ def get_reverse_engineered_sql(conn, **kwargs):
|
||||||
|
|
||||||
status, res = conn.execute_dict(SQL)
|
status, res = conn.execute_dict(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(_('Could not find the index in the table.'))
|
raise ObjectGone(_('Could not find the index in the table.'))
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -119,7 +119,7 @@ def get_reverse_engineered_sql(conn, **kwargs):
|
||||||
|
|
||||||
status, res = conn.execute_dict(SQL)
|
status, res = conn.execute_dict(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(_('Could not find the policy in the table.'))
|
raise ObjectGone(_('Could not find the policy in the table.'))
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from pgadmin.utils.ajax import internal_server_error
|
from pgadmin.utils.ajax import internal_server_error
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
|
from pgadmin.browser.server_groups.servers.databases.schemas.utils \
|
||||||
import trigger_definition
|
import trigger_definition
|
||||||
from config import PG_DEFAULT_DRIVER
|
from config import PG_DEFAULT_DRIVER
|
||||||
|
@ -52,7 +52,7 @@ def get_parent(conn, tid, template_path=None):
|
||||||
'get_parent.sql']), tid=tid)
|
'get_parent.sql']), tid=tid)
|
||||||
status, rset = conn.execute_2darray(SQL)
|
status, rset = conn.execute_2darray(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
schema = ''
|
schema = ''
|
||||||
table = ''
|
table = ''
|
||||||
|
@ -164,7 +164,7 @@ def get_sql(conn, **kwargs):
|
||||||
|
|
||||||
status, res = conn.execute_dict(sql)
|
status, res = conn.execute_dict(sql)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
elif len(res['rows']) == 0:
|
elif len(res['rows']) == 0:
|
||||||
raise ObjectGone(_('Could not find the trigger in the table.'))
|
raise ObjectGone(_('Could not find the trigger in the table.'))
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ def get_reverse_engineered_sql(conn, **kwargs):
|
||||||
|
|
||||||
status, res = conn.execute_dict(SQL)
|
status, res = conn.execute_dict(SQL)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(res)
|
raise ExecuteError(res)
|
||||||
|
|
||||||
if len(res['rows']) == 0:
|
if len(res['rows']) == 0:
|
||||||
raise ObjectGone(_('Could not find the trigger in the table.'))
|
raise ObjectGone(_('Could not find the trigger in the table.'))
|
||||||
|
|
|
@ -21,7 +21,7 @@ from pgadmin.tools.sqleditor.utils.is_query_resultset_updatable \
|
||||||
from pgadmin.tools.sqleditor.utils.save_changed_data import save_changed_data
|
from pgadmin.tools.sqleditor.utils.save_changed_data import save_changed_data
|
||||||
from pgadmin.tools.sqleditor.utils.get_column_types import get_columns_types
|
from pgadmin.tools.sqleditor.utils.get_column_types import get_columns_types
|
||||||
from pgadmin.utils.preferences import Preferences
|
from pgadmin.utils.preferences import Preferences
|
||||||
from pgadmin.utils.exception import ObjectGone
|
from pgadmin.utils.exception import ObjectGone, ExecuteError
|
||||||
|
|
||||||
from config import PG_DEFAULT_DRIVER
|
from config import PG_DEFAULT_DRIVER
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class SQLFilter(object):
|
||||||
|
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
if len(result['rows']) == 0:
|
if len(result['rows']) == 0:
|
||||||
raise ObjectGone(
|
raise ObjectGone(
|
||||||
gettext("The specified object could not be found."))
|
gettext("The specified object could not be found."))
|
||||||
|
@ -401,7 +401,7 @@ class GridCommand(BaseCommand, SQLFilter, FetchedRowTracker):
|
||||||
)
|
)
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
for row in result['rows']:
|
for row in result['rows']:
|
||||||
all_columns.append(row['attname'])
|
all_columns.append(row['attname'])
|
||||||
|
@ -542,7 +542,7 @@ class TableCommand(GridCommand):
|
||||||
|
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
for row in result['rows']:
|
for row in result['rows']:
|
||||||
pk_names += driver.qtIdent(conn, row['attname']) + ','
|
pk_names += driver.qtIdent(conn, row['attname']) + ','
|
||||||
|
@ -590,7 +590,7 @@ class TableCommand(GridCommand):
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
|
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
for row in result['rows']:
|
for row in result['rows']:
|
||||||
all_columns.append(row['attname'])
|
all_columns.append(row['attname'])
|
||||||
|
@ -602,7 +602,7 @@ class TableCommand(GridCommand):
|
||||||
)
|
)
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
for row in result['rows']:
|
for row in result['rows']:
|
||||||
# Only append if not already present in the list
|
# Only append if not already present in the list
|
||||||
|
@ -646,7 +646,7 @@ class TableCommand(GridCommand):
|
||||||
|
|
||||||
status, has_oids = conn.execute_scalar(query)
|
status, has_oids = conn.execute_scalar(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(has_oids)
|
raise ExecuteError(has_oids)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise Exception(
|
raise Exception(
|
||||||
|
@ -996,7 +996,7 @@ class QueryToolCommand(BaseCommand, FetchedRowTracker):
|
||||||
|
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
self.nsp_name = result['rows'][0]['nspname']
|
self.nsp_name = result['rows'][0]['nspname']
|
||||||
self.object_name = result['rows'][0]['relname']
|
self.object_name = result['rows'][0]['relname']
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
from pgadmin.utils.exception import ExecuteError
|
||||||
|
|
||||||
|
|
||||||
def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
|
def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
|
||||||
|
@ -24,7 +25,7 @@ def get_columns_types(is_query_tool, columns_info, table_oid, conn, has_oids):
|
||||||
|
|
||||||
colst, rset = conn.execute_2darray(query)
|
colst, rset = conn.execute_2darray(query)
|
||||||
if not colst:
|
if not colst:
|
||||||
raise Exception(rset)
|
raise ExecuteError(rset)
|
||||||
|
|
||||||
column_types = dict()
|
column_types = dict()
|
||||||
for key, col in enumerate(columns_info):
|
for key, col in enumerate(columns_info):
|
||||||
|
|
|
@ -26,6 +26,7 @@ from flask_babelex import gettext
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
from pgadmin.tools.sqleditor.utils.get_column_types import get_columns_types
|
from pgadmin.tools.sqleditor.utils.get_column_types import get_columns_types
|
||||||
|
from pgadmin.utils.exception import ExecuteError
|
||||||
|
|
||||||
|
|
||||||
def is_query_resultset_updatable(conn, sql_path):
|
def is_query_resultset_updatable(conn, sql_path):
|
||||||
|
@ -135,7 +136,7 @@ def _check_oids(conn, sql_path, table_oid, columns_info):
|
||||||
|
|
||||||
status, has_oids = conn.execute_scalar(query)
|
status, has_oids = conn.execute_scalar(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(has_oids)
|
raise ExecuteError(has_oids)
|
||||||
|
|
||||||
# Check that the oid column is selected in results columns
|
# Check that the oid column is selected in results columns
|
||||||
oid_column_selected = False
|
oid_column_selected = False
|
||||||
|
@ -192,7 +193,7 @@ def _get_primary_keys(sql_path, table_oid, conn):
|
||||||
)
|
)
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
primary_keys_columns = []
|
primary_keys_columns = []
|
||||||
primary_keys = OrderedDict()
|
primary_keys = OrderedDict()
|
||||||
|
@ -216,7 +217,7 @@ def _get_table_columns(sql_path, table_oid, conn):
|
||||||
)
|
)
|
||||||
status, result = conn.execute_dict(query)
|
status, result = conn.execute_dict(query)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception(result)
|
raise ExecuteError(result)
|
||||||
|
|
||||||
columns = {}
|
columns = {}
|
||||||
for row in result['rows']:
|
for row in result['rows']:
|
||||||
|
|
|
@ -12,7 +12,7 @@ from werkzeug.http import HTTP_STATUS_CODES
|
||||||
from flask_babelex import gettext as _
|
from flask_babelex import gettext as _
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from pgadmin.utils.ajax import service_unavailable, gone
|
from pgadmin.utils.ajax import service_unavailable, gone, internal_server_error
|
||||||
|
|
||||||
|
|
||||||
class ConnectionLost(HTTPException):
|
class ConnectionLost(HTTPException):
|
||||||
|
@ -128,3 +128,26 @@ class ObjectGone(HTTPException):
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return self.error_msg
|
return self.error_msg
|
||||||
|
|
||||||
|
|
||||||
|
class ExecuteError(HTTPException):
|
||||||
|
"""
|
||||||
|
ExecuteError
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, error_msg):
|
||||||
|
self.error_msg = error_msg
|
||||||
|
HTTPException.__init__(self)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return HTTP_STATUS_CODES.get(500, 'Internal server error')
|
||||||
|
|
||||||
|
def get_response(self, environ=None):
|
||||||
|
return internal_server_error(self.error_msg)
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.error_msg
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return self.error_msg
|
||||||
|
|
|
@ -1129,9 +1129,9 @@ def check_binary_path_or_skip_test(cls, utility_name):
|
||||||
cls.server['default_binary_paths'][cls.server['type']],
|
cls.server['default_binary_paths'][cls.server['type']],
|
||||||
utility_name
|
utility_name
|
||||||
)
|
)
|
||||||
retVal = does_utility_exist(binary_path)
|
ret_val = does_utility_exist(binary_path)
|
||||||
if retVal is not None:
|
if ret_val is not None:
|
||||||
cls.skipTest(retVal)
|
cls.skipTest(ret_val)
|
||||||
|
|
||||||
|
|
||||||
def get_watcher_dialogue_status(self):
|
def get_watcher_dialogue_status(self):
|
||||||
|
|
Loading…
Reference in New Issue