mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-09 23:15:58 -06:00
Fixed following SoanrQube issues
1) Rename field "node_type" to prevent any misunderstanding/clash with field "NODE_TYPE" defined. 2) Define a constant instead of duplicating this literal. Solution: 1) Rename the field "NODE_TYPE" and "COLLECTION_LABEL" to "_NODE_TYPE" and "_COLLECTION_LABEL" 2) Declare the constant in PGChildNodeView for SQL files.
This commit is contained in:
parent
5d8c79da38
commit
703faf3b15
@ -119,7 +119,7 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
|
||||
|
||||
@property
|
||||
def node_type(self):
|
||||
return '%s' % (self.NODE_TYPE)
|
||||
return '%s' % (self._NODE_TYPE)
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -147,13 +147,13 @@ class CollectionNodeModule(PgAdminModule, PGChildModule):
|
||||
def collection_label(self):
|
||||
"""
|
||||
Label to be shown for the collection node, do not forget to set the
|
||||
class level variable COLLECTION_LABEL.
|
||||
class level variable _COLLECTION_LABEL.
|
||||
"""
|
||||
return gettext(self.COLLECTION_LABEL)
|
||||
return gettext(self._COLLECTION_LABEL)
|
||||
|
||||
@property
|
||||
def label(self):
|
||||
return gettext(self.COLLECTION_LABEL)
|
||||
return gettext(self._COLLECTION_LABEL)
|
||||
|
||||
@property
|
||||
def collection_icon(self):
|
||||
|
@ -26,7 +26,7 @@ from pgadmin.model import db, ServerGroup
|
||||
|
||||
|
||||
class ServerGroupModule(BrowserPluginModule):
|
||||
NODE_TYPE = "server_group"
|
||||
_NODE_TYPE = "server_group"
|
||||
|
||||
def get_nodes(self, *arg, **kwargs):
|
||||
"""Return a JSON document listing the server groups for the user"""
|
||||
@ -47,10 +47,10 @@ class ServerGroupModule(BrowserPluginModule):
|
||||
def node_type(self):
|
||||
"""
|
||||
node_type
|
||||
Node type for Server Group is server-group. It is defined by NODE_TYPE
|
||||
Node type for Server Group is server-group. It is defined by _NODE_TYPE
|
||||
static attribute of the class.
|
||||
"""
|
||||
return self.NODE_TYPE
|
||||
return self._NODE_TYPE
|
||||
|
||||
@property
|
||||
def script_load(self):
|
||||
@ -72,7 +72,7 @@ class ServerGroupModule(BrowserPluginModule):
|
||||
|
||||
class ServerGroupMenuItem(MenuItem):
|
||||
def __init__(self, **kwargs):
|
||||
kwargs.setdefault("type", ServerGroupModule.NODE_TYPE)
|
||||
kwargs.setdefault("type", ServerGroupModule.node_type)
|
||||
super(ServerGroupMenuItem, self).__init__(**kwargs)
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ blueprint = ServerGroupModule(__name__)
|
||||
|
||||
|
||||
class ServerGroupView(NodeView):
|
||||
node_type = ServerGroupModule.NODE_TYPE
|
||||
node_type = ServerGroupModule.node_type
|
||||
parent_ids = []
|
||||
ids = [{'type': 'int', 'id': 'gid'}]
|
||||
|
||||
|
@ -97,12 +97,12 @@ def server_icon_and_background(is_connected, manager, server):
|
||||
|
||||
|
||||
class ServerModule(sg.ServerGroupPluginModule):
|
||||
NODE_TYPE = "server"
|
||||
_NODE_TYPE = "server"
|
||||
LABEL = gettext("Servers")
|
||||
|
||||
@property
|
||||
def node_type(self):
|
||||
return self.NODE_TYPE
|
||||
return self._NODE_TYPE
|
||||
|
||||
@property
|
||||
def script_load(self):
|
||||
@ -110,7 +110,7 @@ class ServerModule(sg.ServerGroupPluginModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return sg.ServerGroupModule.NODE_TYPE
|
||||
return sg.ServerGroupModule.node_type
|
||||
|
||||
@login_required
|
||||
def get_nodes(self, gid):
|
||||
@ -144,7 +144,7 @@ class ServerModule(sg.ServerGroupPluginModule):
|
||||
server.name,
|
||||
server_icon_and_background(connected, manager, server),
|
||||
True,
|
||||
self.NODE_TYPE,
|
||||
self.node_type,
|
||||
connected=connected,
|
||||
server_type=manager.server_type if connected else "pg",
|
||||
version=manager.version,
|
||||
@ -231,7 +231,7 @@ class ServerModule(sg.ServerGroupPluginModule):
|
||||
|
||||
class ServerMenuItem(MenuItem):
|
||||
def __init__(self, **kwargs):
|
||||
kwargs.setdefault("type", ServerModule.NODE_TYPE)
|
||||
kwargs.setdefault("type", ServerModule.node_type)
|
||||
super(ServerMenuItem, self).__init__(**kwargs)
|
||||
|
||||
|
||||
@ -239,7 +239,7 @@ blueprint = ServerModule(__name__)
|
||||
|
||||
|
||||
class ServerNode(PGChildNodeView):
|
||||
node_type = ServerModule.NODE_TYPE
|
||||
node_type = ServerModule._NODE_TYPE
|
||||
|
||||
parent_ids = [{'type': 'int', 'id': 'gid'}]
|
||||
ids = [{'type': 'int', 'id': 'sid'}]
|
||||
|
@ -36,8 +36,8 @@ from pgadmin.model import db, Server, Database
|
||||
|
||||
|
||||
class DatabaseModule(CollectionNodeModule):
|
||||
NODE_TYPE = 'database'
|
||||
COLLECTION_LABEL = _("Databases")
|
||||
_NODE_TYPE = 'database'
|
||||
_COLLECTION_LABEL = _("Databases")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -58,7 +58,7 @@ class DatabaseModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return servers.ServerModule.NODE_TYPE
|
||||
return servers.ServerModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -218,7 +218,7 @@ class DatabaseView(PGChildNodeView):
|
||||
params = tuple(self.manager.db_res.split(','))
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
conn=self.conn,
|
||||
last_system_oid=last_system_oid,
|
||||
db_restrictions=db_disp_res
|
||||
@ -265,7 +265,7 @@ class DatabaseView(PGChildNodeView):
|
||||
)
|
||||
params = tuple(server_node_res.db_res.split(','))
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
last_system_oid=last_system_oid,
|
||||
db_restrictions=db_disp_res
|
||||
)
|
||||
@ -323,7 +323,7 @@ class DatabaseView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
last_system_oid=0,
|
||||
)
|
||||
status, rset = self.conn.execute_dict(SQL)
|
||||
@ -342,7 +342,7 @@ class DatabaseView(PGChildNodeView):
|
||||
@check_precondition(action="node")
|
||||
def node(self, gid, sid, did):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
did=did, conn=self.conn, last_system_oid=0
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -380,7 +380,7 @@ class DatabaseView(PGChildNodeView):
|
||||
def properties(self, gid, sid, did):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, conn=self.conn, last_system_oid=0
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -394,7 +394,7 @@ class DatabaseView(PGChildNodeView):
|
||||
)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'acl.sql']),
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
did=did, conn=self.conn
|
||||
)
|
||||
status, dataclres = self.conn.execute_dict(SQL)
|
||||
@ -582,7 +582,7 @@ class DatabaseView(PGChildNodeView):
|
||||
)
|
||||
# The below SQL will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
status, msg = self.conn.execute_scalar(SQL)
|
||||
@ -595,7 +595,7 @@ class DatabaseView(PGChildNodeView):
|
||||
# The below SQL will execute rest DMLs because we cannot execute
|
||||
# CREATE with any other
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
SQL = SQL.strip('\n').strip(' ')
|
||||
@ -606,7 +606,7 @@ class DatabaseView(PGChildNodeView):
|
||||
|
||||
# We need oid of newly created database
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
name=data['name'], conn=self.conn, last_system_oid=0
|
||||
)
|
||||
SQL = SQL.strip('\n').strip(' ')
|
||||
@ -682,7 +682,7 @@ class DatabaseView(PGChildNodeView):
|
||||
# Fetch the name of database for comparison
|
||||
status, rset = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
did=did, conn=self.conn, last_system_oid=0
|
||||
)
|
||||
)
|
||||
@ -786,7 +786,7 @@ class DatabaseView(PGChildNodeView):
|
||||
# generation
|
||||
status, rset = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
did=did, conn=self.conn, last_system_oid=0
|
||||
)
|
||||
)
|
||||
@ -843,7 +843,7 @@ class DatabaseView(PGChildNodeView):
|
||||
for did in data['ids']:
|
||||
default_conn = self.manager.connection()
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
did=did, conn=self.conn
|
||||
)
|
||||
status, res = default_conn.execute_scalar(SQL)
|
||||
@ -866,7 +866,7 @@ class DatabaseView(PGChildNodeView):
|
||||
status = self.manager.release(did=did)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
datname=res, conn=self.conn
|
||||
)
|
||||
|
||||
@ -917,7 +917,7 @@ class DatabaseView(PGChildNodeView):
|
||||
conn = self.manager.connection()
|
||||
status, rset = conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
did=did, conn=conn, last_system_oid=0
|
||||
)
|
||||
)
|
||||
@ -974,13 +974,13 @@ class DatabaseView(PGChildNodeView):
|
||||
)
|
||||
|
||||
sql_acl = render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=data,
|
||||
conn=self.conn
|
||||
)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
SQL += "\n"
|
||||
@ -1087,7 +1087,7 @@ class DatabaseView(PGChildNodeView):
|
||||
|
||||
conn = self.manager.connection()
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, conn=conn, last_system_oid=0
|
||||
)
|
||||
status, res = conn.execute_dict(SQL)
|
||||
@ -1101,7 +1101,7 @@ class DatabaseView(PGChildNodeView):
|
||||
)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'acl.sql']),
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
did=did, conn=self.conn
|
||||
)
|
||||
status, dataclres = self.conn.execute_dict(SQL)
|
||||
@ -1142,7 +1142,7 @@ class DatabaseView(PGChildNodeView):
|
||||
sql_header = u"-- Database: {0}\n\n-- ".format(result['name'])
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
datname=result['name'], conn=conn
|
||||
)
|
||||
|
||||
|
@ -45,8 +45,8 @@ class CastModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'cast'
|
||||
COLLECTION_LABEL = gettext('Casts')
|
||||
_NODE_TYPE = 'cast'
|
||||
_COLLECTION_LABEL = gettext('Casts')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CastModule, self).__init__(*args, **kwargs)
|
||||
@ -74,7 +74,7 @@ class CastModule(CollectionNodeModule):
|
||||
Load the module script for cast, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -224,7 +224,7 @@ class CastView(PGChildNodeView):
|
||||
if self.manager.db_info is not None and \
|
||||
did in self.manager.db_info else 0
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
datlastsysoid=last_system_oid,
|
||||
showsysobj=self.blueprint.show_system_objects
|
||||
)
|
||||
@ -258,7 +258,7 @@ class CastView(PGChildNodeView):
|
||||
if self.manager.db_info is not None and \
|
||||
did in self.manager.db_info else 0
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
datlastsysoid=last_system_oid,
|
||||
showsysobj=self.blueprint.show_system_objects
|
||||
)
|
||||
@ -286,7 +286,7 @@ class CastView(PGChildNodeView):
|
||||
This function will fetch properties of the cast node
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
cid=cid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -320,7 +320,7 @@ class CastView(PGChildNodeView):
|
||||
self.manager.db_info is not None and \
|
||||
did in self.manager.db_info else 0
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
cid=cid,
|
||||
datlastsysoid=last_system_oid,
|
||||
showsysobj=self.blueprint.show_system_objects
|
||||
@ -368,7 +368,8 @@ class CastView(PGChildNodeView):
|
||||
).format(arg)
|
||||
)
|
||||
try:
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -383,7 +384,7 @@ class CastView(PGChildNodeView):
|
||||
if self.manager.db_info is not None and \
|
||||
did in self.manager.db_info else 0
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
srctyp=data['srctyp'],
|
||||
trgtyp=data['trgtyp'],
|
||||
datlastsysoid=last_system_oid,
|
||||
@ -466,7 +467,7 @@ class CastView(PGChildNodeView):
|
||||
try:
|
||||
# Get name for cast from cid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
cid=cid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -487,7 +488,7 @@ class CastView(PGChildNodeView):
|
||||
# drop cast
|
||||
result = res['rows'][0]
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
castsource=result['castsource'],
|
||||
casttarget=result['casttarget'],
|
||||
cascade=cascade
|
||||
@ -544,7 +545,7 @@ class CastView(PGChildNodeView):
|
||||
if self.manager.db_info is not None and \
|
||||
did in self.manager.db_info else 0
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
cid=cid,
|
||||
datlastsysoid=last_system_oid,
|
||||
showsysobj=self.blueprint.show_system_objects
|
||||
@ -561,14 +562,14 @@ class CastView(PGChildNodeView):
|
||||
|
||||
old_data = res['rows'][0]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
return sql, data['name'] if 'name' in data else old_data['name']
|
||||
else:
|
||||
if 'srctyp' in data and 'trgtyp' in data:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
else:
|
||||
|
@ -43,8 +43,8 @@ class EventTriggerModule(CollectionNodeModule):
|
||||
is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'event_trigger'
|
||||
COLLECTION_LABEL = gettext("Event Triggers")
|
||||
_NODE_TYPE = 'event_trigger'
|
||||
_COLLECTION_LABEL = gettext("Event Triggers")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -80,7 +80,7 @@ class EventTriggerModule(CollectionNodeModule):
|
||||
Load the module script for event_trigger, when any of the database node
|
||||
is initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -215,7 +215,8 @@ class EventTriggerView(PGChildNodeView):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']))
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]))
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
if not status:
|
||||
@ -242,7 +243,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
|
||||
"""
|
||||
result = []
|
||||
sql = render_template("/".join([self.template_path, 'nodes.sql']))
|
||||
sql = render_template("/".join([self.template_path, self._NODES_SQL]))
|
||||
status, res = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -275,7 +276,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
Returns:
|
||||
Json object of trigger node
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'nodes.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._NODES_SQL]),
|
||||
etid=etid)
|
||||
status, res = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -326,7 +327,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
etid=etid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -385,14 +386,14 @@ class EventTriggerView(PGChildNodeView):
|
||||
)
|
||||
try:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
sql = sql.strip('\n').strip(' ')
|
||||
@ -402,7 +403,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
data=data
|
||||
)
|
||||
status, etid = self.conn.execute_scalar(sql)
|
||||
@ -451,7 +452,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
data=data
|
||||
)
|
||||
status, etid = self.conn.execute_scalar(sql)
|
||||
@ -510,7 +511,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
try:
|
||||
for etid in data['ids']:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
etid=etid
|
||||
)
|
||||
status, name = self.conn.execute_scalar(sql)
|
||||
@ -530,7 +531,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
name=name, cascade=cascade
|
||||
)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
@ -600,7 +601,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
|
||||
if etid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
etid=etid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -619,7 +620,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
if arg not in data:
|
||||
data[arg] = old_data[arg]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
else:
|
||||
@ -648,12 +649,12 @@ class EventTriggerView(PGChildNodeView):
|
||||
).format(arg)
|
||||
)
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data
|
||||
)
|
||||
sql += "\n"
|
||||
sql += render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=data
|
||||
)
|
||||
return sql
|
||||
@ -674,7 +675,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
etid=etid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -692,12 +693,12 @@ class EventTriggerView(PGChildNodeView):
|
||||
result = self._formatter(result)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=result, conn=self.conn
|
||||
)
|
||||
sql += "\n\n"
|
||||
sql += render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=result, conn=self.conn
|
||||
)
|
||||
|
||||
@ -714,7 +715,7 @@ class EventTriggerView(PGChildNodeView):
|
||||
)
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
name=result['name'], )
|
||||
sql_header += "\n"
|
||||
|
||||
|
@ -31,8 +31,8 @@ class ExtensionModule(CollectionNodeModule):
|
||||
class and define methods to get child nodes, to load its own
|
||||
javascript file.
|
||||
"""
|
||||
NODE_TYPE = "extension"
|
||||
COLLECTION_LABEL = gettext("Extensions")
|
||||
_NODE_TYPE = "extension"
|
||||
_COLLECTION_LABEL = gettext("Extensions")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -60,7 +60,7 @@ class ExtensionModule(CollectionNodeModule):
|
||||
Load the module script for extension, when any of the database nodes
|
||||
are initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -147,7 +147,8 @@ class ExtensionView(PGChildNodeView):
|
||||
"""
|
||||
Fetches all extensions properties and render into properties tab
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']))
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]))
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -163,7 +164,8 @@ class ExtensionView(PGChildNodeView):
|
||||
Lists all extensions under the Extensions Collection node
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']))
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]))
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -187,7 +189,8 @@ class ExtensionView(PGChildNodeView):
|
||||
"""
|
||||
This function will fetch the properties of extension
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
eid=eid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -212,7 +215,7 @@ class ExtensionView(PGChildNodeView):
|
||||
Fetch the properties of a single extension and render in properties tab
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']), eid=eid)
|
||||
[self.template_path, self._PROPERTIES_SQL]), eid=eid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -254,7 +257,7 @@ class ExtensionView(PGChildNodeView):
|
||||
|
||||
status, res = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data
|
||||
)
|
||||
)
|
||||
@ -264,7 +267,7 @@ class ExtensionView(PGChildNodeView):
|
||||
|
||||
status, rset = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
ename=data['name']
|
||||
)
|
||||
)
|
||||
@ -331,7 +334,7 @@ class ExtensionView(PGChildNodeView):
|
||||
for eid in data['ids']:
|
||||
# check if extension with eid exists
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'delete.sql']), eid=eid)
|
||||
[self.template_path, self._DELETE_SQL]), eid=eid)
|
||||
status, name = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=name)
|
||||
@ -350,7 +353,7 @@ class ExtensionView(PGChildNodeView):
|
||||
|
||||
# drop extension
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'delete.sql']
|
||||
[self.template_path, self._DELETE_SQL]
|
||||
), name=name, cascade=cascade)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -395,7 +398,7 @@ class ExtensionView(PGChildNodeView):
|
||||
|
||||
if eid is not None:
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']
|
||||
[self.template_path, self._PROPERTIES_SQL]
|
||||
), eid=eid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -411,12 +414,12 @@ class ExtensionView(PGChildNodeView):
|
||||
if arg not in data:
|
||||
data[arg] = old_data[arg]
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'update.sql']
|
||||
[self.template_path, self._UPDATE_SQL]
|
||||
), data=data, o_data=old_data)
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
else:
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'create.sql']
|
||||
[self.template_path, self._CREATE_SQL]
|
||||
), data=data)
|
||||
return SQL, data['name']
|
||||
|
||||
@ -454,7 +457,7 @@ class ExtensionView(PGChildNodeView):
|
||||
This function will generate sql for the sql panel
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']
|
||||
[self.template_path, self._PROPERTIES_SQL]
|
||||
), eid=eid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -467,7 +470,7 @@ class ExtensionView(PGChildNodeView):
|
||||
result = res['rows'][0]
|
||||
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'create.sql']
|
||||
[self.template_path, self._CREATE_SQL]
|
||||
),
|
||||
data=result,
|
||||
conn=self.conn,
|
||||
|
@ -52,8 +52,8 @@ class ExternalTablesModule(CollectionNodeModule):
|
||||
the database node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'external_table'
|
||||
COLLECTION_LABEL = gettext("External Tables")
|
||||
_NODE_TYPE = 'external_table'
|
||||
_COLLECTION_LABEL = gettext("External Tables")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -80,7 +80,7 @@ class ExternalTablesModule(CollectionNodeModule):
|
||||
|
||||
Returns: node type of the database module.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -191,7 +191,7 @@ class ExternalTablesView(PGChildNodeView):
|
||||
sql_statement = render_template(
|
||||
template_name_or_list=os.path.join(
|
||||
self.sql_template_path,
|
||||
'node.sql'
|
||||
self._NODE_SQL
|
||||
),
|
||||
external_table_id=external_table_id
|
||||
)
|
||||
|
@ -46,8 +46,8 @@ class ForeignDataWrapperModule(CollectionNodeModule):
|
||||
when any of the database node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'foreign_data_wrapper'
|
||||
COLLECTION_LABEL = gettext("Foreign Data Wrappers")
|
||||
_NODE_TYPE = 'foreign_data_wrapper'
|
||||
_COLLECTION_LABEL = gettext("Foreign Data Wrappers")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -84,7 +84,7 @@ class ForeignDataWrapperModule(CollectionNodeModule):
|
||||
|
||||
Returns: node type of the databse module.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -238,7 +238,8 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
sid: Server ID
|
||||
did: Database ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -268,7 +269,8 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
did: Database ID
|
||||
"""
|
||||
res = []
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
conn=self.conn
|
||||
)
|
||||
status, r_set = self.conn.execute_2darray(sql)
|
||||
@ -300,7 +302,8 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
did: Database ID
|
||||
fid: Foreign data wrapper ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
conn=self.conn, fid=fid)
|
||||
status, r_set = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -333,7 +336,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
fid: foreign data wrapper ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fid=fid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -356,7 +359,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
'fdwoption', 'fdwvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
fid=fid
|
||||
)
|
||||
status, fdw_acl_res = self.conn.execute_dict(sql)
|
||||
@ -412,7 +415,8 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
data['fdwoptions'], 'fdwoption', 'fdwvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
is_valid_options=is_valid_options
|
||||
@ -422,7 +426,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fname=data['name'],
|
||||
conn=self.conn
|
||||
)
|
||||
@ -508,7 +512,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
try:
|
||||
# Get name of foreign data wrapper from fid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
fid=fid, conn=self.conn
|
||||
)
|
||||
status, name = self.conn.execute_scalar(sql)
|
||||
@ -529,7 +533,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
)
|
||||
# drop foreign data wrapper node
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=name,
|
||||
cascade=cascade,
|
||||
conn=self.conn)
|
||||
@ -601,7 +605,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
|
||||
if fid is not None:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fid=fid,
|
||||
conn=self.conn
|
||||
)
|
||||
@ -661,7 +665,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
'fdwvalue')
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data,
|
||||
o_data=old_data,
|
||||
is_valid_added_options=is_valid_added_options,
|
||||
@ -683,7 +687,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn,
|
||||
is_valid_options=is_valid_options
|
||||
)
|
||||
@ -702,7 +706,8 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
did: Database ID
|
||||
fid: Foreign data wrapper ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fid=fid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -724,7 +729,7 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
if len(res['rows'][0]['fdwoptions']) > 0:
|
||||
is_valid_options = True
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
fid=fid)
|
||||
status, fdw_acl_res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -745,7 +750,8 @@ class ForeignDataWrapperView(PGChildNodeView):
|
||||
)
|
||||
|
||||
sql = ''
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=res['rows'][0], conn=self.conn,
|
||||
is_valid_options=is_valid_options
|
||||
)
|
||||
|
@ -46,8 +46,8 @@ class ForeignServerModule(CollectionNodeModule):
|
||||
the database node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'foreign_server'
|
||||
COLLECTION_LABEL = gettext("Foreign Servers")
|
||||
_NODE_TYPE = 'foreign_server'
|
||||
_COLLECTION_LABEL = gettext("Foreign Servers")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -84,7 +84,7 @@ class ForeignServerModule(CollectionNodeModule):
|
||||
|
||||
Returns: node type of the server module.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -230,7 +230,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
fid: Foreign data wrapper ID
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fid=fid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -257,7 +258,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
res = []
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fid=fid, conn=self.conn)
|
||||
status, r_set = self.conn.execute_2darray(sql)
|
||||
|
||||
@ -291,7 +293,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
fsid: Foreign server ID
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, r_set = self.conn.execute_2darray(sql)
|
||||
|
||||
@ -326,7 +329,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
fsid: foreign server ID
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -346,7 +350,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
res['rows'][0]['fsrvoptions'], 'fsrvoption', 'fsrvvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
fsid=fsid
|
||||
)
|
||||
status, fs_rv_acl_res = self.conn.execute_dict(sql)
|
||||
@ -399,7 +403,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
data['fsrvacl'] = parse_priv_to_db(data['fsrvacl'], ['U'])
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fdwid=fid, conn=self.conn)
|
||||
status, res1 = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -416,7 +420,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
data['fsrvoptions'], 'fsrvoption', 'fsrvvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, fdwdata=fdw_data,
|
||||
is_valid_options=is_valid_options,
|
||||
conn=self.conn)
|
||||
@ -425,7 +430,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
data=data, fdwdata=fdw_data,
|
||||
conn=self.conn)
|
||||
status, r_set = self.conn.execute_dict(sql)
|
||||
@ -513,7 +518,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
for fsid in data['ids']:
|
||||
# Get name of foreign data wrapper from fid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, name = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
@ -534,7 +539,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
|
||||
# drop foreign server
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=name, cascade=cascade,
|
||||
conn=self.conn)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
@ -608,7 +613,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
|
||||
if fsid is not None:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -662,7 +667,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
'fsrvvalue')
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data,
|
||||
o_data=old_data,
|
||||
is_valid_added_options=is_valid_added_options,
|
||||
@ -672,7 +677,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
return sql, data['name'] if 'name' in data else old_data['name']
|
||||
else:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fdwid=fid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -690,7 +695,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
data['fsrvoptions'], 'fsrvoption', 'fsrvvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, fdwdata=fdw_data,
|
||||
is_valid_options=is_valid_options,
|
||||
conn=self.conn)
|
||||
@ -711,7 +717,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
fsid: Foreign server ID
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -730,7 +737,7 @@ class ForeignServerView(PGChildNodeView):
|
||||
if len(res['rows'][0]['fsrvoptions']) > 0:
|
||||
is_valid_options = True
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
fsid=fsid)
|
||||
status, fs_rv_acl_res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -750,7 +757,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
['U']
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fdwid=fid, conn=self.conn)
|
||||
status, res1 = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -759,7 +767,8 @@ class ForeignServerView(PGChildNodeView):
|
||||
fdw_data = res1['rows'][0]
|
||||
|
||||
sql = ''
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=res['rows'][0], fdwdata=fdw_data,
|
||||
is_valid_options=is_valid_options,
|
||||
conn=self.conn)
|
||||
|
@ -50,8 +50,8 @@ class UserMappingModule(CollectionNodeModule):
|
||||
foreign server node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'user_mapping'
|
||||
COLLECTION_LABEL = gettext("User Mappings")
|
||||
_NODE_TYPE = 'user_mapping'
|
||||
_COLLECTION_LABEL = gettext("User Mappings")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -100,7 +100,7 @@ class UserMappingModule(CollectionNodeModule):
|
||||
Returns: node type of the server module.
|
||||
"""
|
||||
|
||||
return servers.ServerModule.NODE_TYPE
|
||||
return servers.ServerModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -248,7 +248,7 @@ class UserMappingView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -277,7 +277,7 @@ class UserMappingView(PGChildNodeView):
|
||||
|
||||
res = []
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, r_set = self.conn.execute_2darray(sql)
|
||||
|
||||
@ -312,7 +312,7 @@ class UserMappingView(PGChildNodeView):
|
||||
umid: User mapping ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
conn=self.conn, umid=umid)
|
||||
status, r_set = self.conn.execute_2darray(sql)
|
||||
|
||||
@ -348,7 +348,7 @@ class UserMappingView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
umid=umid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -405,7 +405,7 @@ class UserMappingView(PGChildNodeView):
|
||||
|
||||
try:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fserid=fsid, conn=self.conn)
|
||||
status, res1 = self.conn.execute_dict(sql)
|
||||
|
||||
@ -423,7 +423,8 @@ class UserMappingView(PGChildNodeView):
|
||||
data['umoptions'], 'umoption', 'umvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, fdwdata=fdw_data,
|
||||
is_valid_options=is_valid_options,
|
||||
conn=self.conn)
|
||||
@ -432,7 +433,7 @@ class UserMappingView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fsid=fsid, data=data,
|
||||
conn=self.conn)
|
||||
status, r_set = self.conn.execute_dict(sql)
|
||||
@ -521,7 +522,7 @@ class UserMappingView(PGChildNodeView):
|
||||
for umid in data['ids']:
|
||||
# Get name of foreign server from fsid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
fsid=fsid, conn=self.conn)
|
||||
status, name = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
@ -541,7 +542,7 @@ class UserMappingView(PGChildNodeView):
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
umid=umid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -560,7 +561,7 @@ class UserMappingView(PGChildNodeView):
|
||||
|
||||
# drop user mapping
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data, name=name, cascade=cascade,
|
||||
conn=self.conn)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
@ -626,7 +627,7 @@ class UserMappingView(PGChildNodeView):
|
||||
|
||||
if umid is not None:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
umid=umid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -644,7 +645,7 @@ class UserMappingView(PGChildNodeView):
|
||||
old_data = res['rows'][0]
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fserid=fsid, conn=self.conn)
|
||||
status, res1 = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -673,7 +674,7 @@ class UserMappingView(PGChildNodeView):
|
||||
'umvalue')
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data,
|
||||
o_data=old_data,
|
||||
is_valid_added_options=is_valid_added_options,
|
||||
@ -684,7 +685,7 @@ class UserMappingView(PGChildNodeView):
|
||||
return sql, data['name'] if 'name' in data else old_data['name']
|
||||
else:
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
fserid=fsid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -697,7 +698,8 @@ class UserMappingView(PGChildNodeView):
|
||||
data['umoptions'], 'umoption', 'umvalue'
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, fdwdata=fdw_data,
|
||||
is_valid_options=is_valid_options,
|
||||
conn=self.conn)
|
||||
@ -719,7 +721,8 @@ class UserMappingView(PGChildNodeView):
|
||||
umid: User mapping ID
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
umid=umid, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -738,7 +741,8 @@ class UserMappingView(PGChildNodeView):
|
||||
if len(res['rows'][0]['umoptions']) > 0:
|
||||
is_valid_options = True
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
fserid=fsid, conn=self.conn
|
||||
)
|
||||
status, res1 = self.conn.execute_dict(sql)
|
||||
@ -748,7 +752,8 @@ class UserMappingView(PGChildNodeView):
|
||||
fdw_data = res1['rows'][0]
|
||||
|
||||
sql = ''
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=res['rows'][0], fdwdata=fdw_data,
|
||||
is_valid_options=is_valid_options,
|
||||
conn=self.conn)
|
||||
|
@ -47,8 +47,8 @@ class LanguageModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'language'
|
||||
COLLECTION_LABEL = gettext("Languages")
|
||||
_NODE_TYPE = 'language'
|
||||
_COLLECTION_LABEL = gettext("Languages")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -91,7 +91,7 @@ class LanguageModule(CollectionNodeModule):
|
||||
|
||||
Returns: node type of the server module.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -253,7 +253,8 @@ class LanguageView(PGChildNodeView):
|
||||
sid: Server ID
|
||||
did: Database ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']))
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]))
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
if not status:
|
||||
@ -275,7 +276,8 @@ class LanguageView(PGChildNodeView):
|
||||
did: Database ID
|
||||
"""
|
||||
res = []
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']))
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]))
|
||||
status, result = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=result)
|
||||
@ -305,7 +307,8 @@ class LanguageView(PGChildNodeView):
|
||||
did: Database ID
|
||||
lid: Language ID
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
lid=lid)
|
||||
status, result = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -336,7 +339,7 @@ class LanguageView(PGChildNodeView):
|
||||
lid: Language ID
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
lid=lid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -353,7 +356,7 @@ class LanguageView(PGChildNodeView):
|
||||
res['rows'][0]['oid'] <= self.datlastsysoid)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'acl.sql']),
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
lid=lid
|
||||
)
|
||||
status, result = self.conn.execute_dict(sql)
|
||||
@ -465,14 +468,15 @@ class LanguageView(PGChildNodeView):
|
||||
if 'lanacl' in data:
|
||||
data['lanacl'] = parse_priv_to_db(data['lanacl'], ['U'])
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
lanname=data['name'], conn=self.conn
|
||||
)
|
||||
|
||||
@ -521,7 +525,7 @@ class LanguageView(PGChildNodeView):
|
||||
for lid in data['ids']:
|
||||
# Get name for language from lid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
lid=lid, conn=self.conn
|
||||
)
|
||||
status, lname = self.conn.execute_scalar(sql)
|
||||
@ -531,7 +535,7 @@ class LanguageView(PGChildNodeView):
|
||||
|
||||
# drop language
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
lname=lname, cascade=cascade, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
@ -599,7 +603,7 @@ class LanguageView(PGChildNodeView):
|
||||
|
||||
if lid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']), lid=lid
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]), lid=lid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -630,7 +634,7 @@ class LanguageView(PGChildNodeView):
|
||||
if arg not in data:
|
||||
data[arg] = old_data[arg]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
return sql.strip('\n'), data['name'] if 'name' in data \
|
||||
@ -640,7 +644,8 @@ class LanguageView(PGChildNodeView):
|
||||
if 'lanacl' in data:
|
||||
data['lanacl'] = parse_priv_to_db(data['lanacl'], ["U"])
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
return sql.strip('\n'), data['name']
|
||||
|
||||
@ -696,7 +701,7 @@ class LanguageView(PGChildNodeView):
|
||||
lid: Language ID
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
lid=lid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -712,7 +717,7 @@ class LanguageView(PGChildNodeView):
|
||||
old_data = dict(res['rows'][0])
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'acl.sql']),
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
lid=lid
|
||||
)
|
||||
status, result = self.conn.execute_dict(sql)
|
||||
|
@ -65,8 +65,8 @@ class SchemaModule(CollectionNodeModule):
|
||||
- Load the module script for schema, when any of the server node is
|
||||
initialized.
|
||||
"""
|
||||
NODE_TYPE = 'schema'
|
||||
COLLECTION_LABEL = gettext("Schemas")
|
||||
_NODE_TYPE = 'schema'
|
||||
_COLLECTION_LABEL = gettext("Schemas")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -93,7 +93,7 @@ class SchemaModule(CollectionNodeModule):
|
||||
Load the module script for schema, when any of the server node is
|
||||
initialized.
|
||||
"""
|
||||
return servers.ServerModule.NODE_TYPE
|
||||
return servers.ServerModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -111,8 +111,8 @@ class CatalogModule(SchemaModule):
|
||||
A module class for the catalog schema node derived from SchemaModule.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'catalog'
|
||||
COLLECTION_LABEL = gettext("Catalogs")
|
||||
_NODE_TYPE = 'catalog'
|
||||
_COLLECTION_LABEL = gettext("Catalogs")
|
||||
|
||||
|
||||
schema_blueprint = SchemaModule(__name__)
|
||||
|
@ -43,8 +43,8 @@ class CatalogObjectModule(SchemaChildModule):
|
||||
- Load the module script for Catalog objects, when any of the server node
|
||||
is initialized.
|
||||
"""
|
||||
NODE_TYPE = 'catalog_object'
|
||||
COLLECTION_LABEL = gettext("Catalog Objects")
|
||||
_NODE_TYPE = 'catalog_object'
|
||||
_COLLECTION_LABEL = gettext("Catalog Objects")
|
||||
|
||||
# Flag for not to show node under Schema/Catalog node
|
||||
# By default its set to True to display node in schema/catalog
|
||||
@ -78,7 +78,7 @@ class CatalogObjectModule(SchemaChildModule):
|
||||
Load the module script for server, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = CatalogObjectModule(__name__)
|
||||
@ -176,7 +176,7 @@ class CatalogObjectView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([
|
||||
self.template_path, 'properties.sql'
|
||||
self.template_path, self._PROPERTIES_SQL
|
||||
]), scid=scid
|
||||
)
|
||||
|
||||
@ -207,7 +207,7 @@ class CatalogObjectView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']), scid=scid
|
||||
"/".join([self.template_path, self._NODES_SQL]), scid=scid
|
||||
)
|
||||
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -244,7 +244,7 @@ class CatalogObjectView(PGChildNodeView):
|
||||
JSON of given catalog objects child node
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']), coid=coid
|
||||
"/".join([self.template_path, self._NODES_SQL]), coid=coid
|
||||
)
|
||||
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -283,7 +283,7 @@ class CatalogObjectView(PGChildNodeView):
|
||||
JSON of selected catalog objects node
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, coid=coid
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
@ -47,8 +47,8 @@ class CatalogObjectColumnsModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'catalog_object_column'
|
||||
COLLECTION_LABEL = gettext("Columns")
|
||||
_NODE_TYPE = 'catalog_object_column'
|
||||
_COLLECTION_LABEL = gettext("Columns")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -74,7 +74,7 @@ class CatalogObjectColumnsModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -201,7 +201,7 @@ class CatalogObjectColumnsView(PGChildNodeView):
|
||||
JSON of available column nodes
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), coid=coid)
|
||||
self._PROPERTIES_SQL]), coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -230,7 +230,7 @@ class CatalogObjectColumnsView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), coid=coid)
|
||||
self._NODES_SQL]), coid=coid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -267,7 +267,7 @@ class CatalogObjectColumnsView(PGChildNodeView):
|
||||
JSON of selected column node
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), coid=coid,
|
||||
self._PROPERTIES_SQL]), coid=coid,
|
||||
clid=clid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
|
@ -50,8 +50,8 @@ class CollationModule(SchemaChildModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'collation'
|
||||
COLLECTION_LABEL = gettext("Collations")
|
||||
_NODE_TYPE = 'collation'
|
||||
_COLLECTION_LABEL = gettext("Collations")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -79,7 +79,7 @@ class CollationModule(SchemaChildModule):
|
||||
Load the module script for database, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -225,7 +225,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), scid=scid)
|
||||
self._PROPERTIES_SQL]), scid=scid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -254,7 +254,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -290,7 +290,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), coid=coid)
|
||||
self._NODES_SQL]), coid=coid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -343,7 +343,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, coid=coid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -474,7 +474,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
@ -483,7 +483,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# We need oid to to add object in tree at browser
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']), data=data
|
||||
"/".join([self.template_path, self._OID_SQL]), data=data
|
||||
)
|
||||
status, coid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -491,7 +491,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Get updated schema oid
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']), coid=coid
|
||||
"/".join([self.template_path, self._OID_SQL]), coid=coid
|
||||
)
|
||||
|
||||
status, new_scid = self.conn.execute_scalar(SQL)
|
||||
@ -551,7 +551,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = res['rows'][0]
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=data['name'],
|
||||
nspname=data['schema'],
|
||||
cascade=cascade,
|
||||
@ -600,7 +600,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# We need oid to to add object in tree at browser
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']), coid=coid)
|
||||
self._OID_SQL]), coid=coid)
|
||||
|
||||
status, res = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -662,7 +662,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
if coid is not None:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -675,7 +675,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
old_data = res['rows'][0]
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
return SQL.strip('\n'), data['name'] if 'name' in data else \
|
||||
@ -693,7 +693,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return "-- missing definition"
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
return SQL.strip('\n'), data['name']
|
||||
|
||||
@ -716,7 +716,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -732,13 +732,13 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data['schema'] = diff_schema
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
|
||||
sql_header = u"-- Collation: {0};\n\n-- ".format(data['name'])
|
||||
|
||||
sql_header += render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=data['name'],
|
||||
nspname=data['schema'])
|
||||
SQL = sql_header + '\n\n' + SQL.strip('\n')
|
||||
@ -805,7 +805,7 @@ class CollationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -49,8 +49,8 @@ class DomainModule(SchemaChildModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'domain'
|
||||
COLLECTION_LABEL = gettext("Domains")
|
||||
_NODE_TYPE = 'domain'
|
||||
_COLLECTION_LABEL = gettext("Domains")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DomainModule, self).__init__(*args, **kwargs)
|
||||
@ -70,7 +70,7 @@ class DomainModule(SchemaChildModule):
|
||||
Load the module script for domain, when schema node is
|
||||
initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = DomainModule(__name__)
|
||||
@ -288,7 +288,7 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
scid: Schema Id
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'node.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODE_SQL]),
|
||||
scid=scid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -312,7 +312,7 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path, 'node.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODE_SQL]),
|
||||
scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -345,7 +345,7 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
doid: Domain Id
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'node.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODE_SQL]),
|
||||
doid=doid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -393,7 +393,8 @@ class DomainView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
:param doid:
|
||||
:return:
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, doid=doid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -559,7 +560,7 @@ AND relkind != 'c'))"""
|
||||
# We need oid to to add object in tree at browser, below sql will
|
||||
# gives the same
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
basensp=data['basensp'],
|
||||
name=data['name'])
|
||||
status, doid = self.conn.execute_scalar(SQL)
|
||||
@ -568,7 +569,7 @@ AND relkind != 'c'))"""
|
||||
|
||||
# Get updated schema oid
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
doid=doid)
|
||||
status, scid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -611,7 +612,7 @@ AND relkind != 'c'))"""
|
||||
|
||||
for doid in data['ids']:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
scid=scid, doid=doid)
|
||||
status, res = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -633,7 +634,7 @@ AND relkind != 'c'))"""
|
||||
basensp = res['rows'][0]['basensp']
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=name, basensp=basensp, cascade=cascade)
|
||||
|
||||
# Used for schema diff tool
|
||||
@ -674,7 +675,7 @@ AND relkind != 'c'))"""
|
||||
|
||||
# Get Schema Id
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
doid=doid)
|
||||
status, scid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -707,7 +708,7 @@ AND relkind != 'c'))"""
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, doid=doid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -740,7 +741,7 @@ AND relkind != 'c'))"""
|
||||
data.update(parse_sec_labels_from_db(data['seclabels']))
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']), data=data)
|
||||
self._CREATE_SQL]), data=data)
|
||||
|
||||
sql_header = u"""-- DOMAIN: {0}.{1}\n\n""".format(
|
||||
data['basensp'], data['name'])
|
||||
@ -807,7 +808,7 @@ AND relkind != 'c'))"""
|
||||
|
||||
if doid is not None:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, doid=doid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -845,13 +846,13 @@ AND relkind != 'c'))"""
|
||||
data['is_schema_diff'] = True
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data)
|
||||
return SQL.strip('\n'), data['name'] if 'name' in data else \
|
||||
old_data['name']
|
||||
else:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data)
|
||||
return SQL.strip('\n'), data['name']
|
||||
|
||||
@ -906,7 +907,7 @@ AND relkind != 'c'))"""
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'node.sql']), scid=scid)
|
||||
self._NODE_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -47,8 +47,8 @@ class DomainConstraintModule(CollectionNodeModule):
|
||||
- Load the module script for the Domain Constraint, when any of the
|
||||
Domain node is initialized.
|
||||
"""
|
||||
NODE_TYPE = 'domain_constraints'
|
||||
COLLECTION_LABEL = gettext("Domain Constraints")
|
||||
_NODE_TYPE = 'domain_constraints'
|
||||
_COLLECTION_LABEL = gettext("Domain Constraints")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(DomainConstraintModule, self).__init__(*args, **kwargs)
|
||||
@ -74,7 +74,7 @@ class DomainConstraintModule(CollectionNodeModule):
|
||||
Load the module script for the Domain Constraint, when any of the
|
||||
Domain node is initialized.
|
||||
"""
|
||||
return domains.DomainModule.NODE_TYPE
|
||||
return domains.DomainModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -272,7 +272,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
doid: Domain Id
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
doid=doid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -297,7 +297,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
doid=doid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -338,7 +338,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
coid: Domain Constraint Id
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
coid=coid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -381,7 +381,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
doid=doid, coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -430,7 +430,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
|
||||
# Get the recently added constraints oid
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
doid=doid, name=data['name'])
|
||||
status, coid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -479,7 +479,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
try:
|
||||
for coid in data['ids']:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
doid=doid, coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -502,7 +502,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
data = res['rows'][0]
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -591,7 +591,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
schema, domain = self._get_domain(doid)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
doid=doid, coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -605,7 +605,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
data = res['rows'][0]
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, domain=domain, schema=schema)
|
||||
|
||||
sql_header = u"""-- CHECK: {1}.{0}
|
||||
@ -662,7 +662,7 @@ class DomainConstraintView(PGChildNodeView):
|
||||
try:
|
||||
if coid is not None:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
doid=doid, coid=coid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -677,14 +677,14 @@ class DomainConstraintView(PGChildNodeView):
|
||||
old_data = res['rows'][0]
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
else:
|
||||
schema, domain = self._get_domain(doid)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, domain=domain, schema=schema)
|
||||
if 'name' in data:
|
||||
return True, SQL.strip('\n'), data['name']
|
||||
|
@ -56,8 +56,8 @@ class ForeignTableModule(SchemaChildModule):
|
||||
- Load the module script for Foreign Table, when schema node is
|
||||
initialized.
|
||||
"""
|
||||
NODE_TYPE = 'foreign_table'
|
||||
COLLECTION_LABEL = gettext("Foreign Tables")
|
||||
_NODE_TYPE = 'foreign_table'
|
||||
_COLLECTION_LABEL = gettext("Foreign Tables")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ForeignTableModule, self).__init__(*args, **kwargs)
|
||||
@ -84,7 +84,7 @@ class ForeignTableModule(SchemaChildModule):
|
||||
Load the module script for foreign table, when the
|
||||
schema node is initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = ForeignTableModule(__name__)
|
||||
@ -363,7 +363,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
did: Database Id
|
||||
scid: Schema Id
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'node.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODE_SQL]),
|
||||
scid=scid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -388,7 +388,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'node.sql']), scid=scid)
|
||||
self._NODE_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
if not status:
|
||||
@ -422,7 +422,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'node.sql']), foid=foid)
|
||||
self._NODE_SQL]), foid=foid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
if not status:
|
||||
@ -680,7 +680,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
basensp = self.request['basensp'] if ('basensp' in self.request) \
|
||||
else None
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
basensp=basensp,
|
||||
name=self.request['name'])
|
||||
status, res = self.conn.execute_2darray(SQL)
|
||||
@ -731,7 +731,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
for foid in data['ids']:
|
||||
# Fetch Name and Schema Name to delete the foreign table.
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']), scid=scid,
|
||||
self._DELETE_SQL]), scid=scid,
|
||||
foid=foid)
|
||||
status, res = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -752,7 +752,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
basensp = res['rows'][0]['basensp']
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=name,
|
||||
basensp=basensp,
|
||||
cascade=cascade)
|
||||
@ -800,7 +800,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
foid=foid)
|
||||
status, res = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -860,7 +860,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
["a", "r", "w", "x"])
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']), data=data, is_sql=True)
|
||||
self._CREATE_SQL]),
|
||||
data=data, is_sql=True)
|
||||
|
||||
if not json_resp:
|
||||
return SQL.strip('\n')
|
||||
@ -1011,7 +1012,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
data=data, o_data=old_data)
|
||||
else:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
@ -1024,7 +1025,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
["a", "r", "w", "x"])
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']), data=data)
|
||||
self._CREATE_SQL]), data=data)
|
||||
return SQL, data['name']
|
||||
|
||||
@check_precondition
|
||||
@ -1099,7 +1100,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, foid=foid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -1114,7 +1115,8 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
|
||||
if self.manager.version >= 90200:
|
||||
# Fetch privileges
|
||||
SQL = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._ACL_SQL]),
|
||||
foid=foid)
|
||||
status, aclres = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -1433,7 +1435,7 @@ class ForeignTableView(PGChildNodeView, DataTypeReader,
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'node.sql']), scid=scid)
|
||||
self._NODE_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -51,8 +51,8 @@ class FtsConfigurationModule(SchemaChildModule):
|
||||
node is initialized.
|
||||
|
||||
"""
|
||||
NODE_TYPE = 'fts_configuration'
|
||||
COLLECTION_LABEL = _('FTS Configurations')
|
||||
_NODE_TYPE = 'fts_configuration'
|
||||
_COLLECTION_LABEL = _('FTS Configurations')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -84,7 +84,7 @@ class FtsConfigurationModule(SchemaChildModule):
|
||||
Load the module script for fts template, when any of the schema
|
||||
node is initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = FtsConfigurationModule(__name__)
|
||||
@ -250,7 +250,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -277,7 +277,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -312,7 +312,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
cfgid=cfgid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -365,7 +365,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
cfgid=cfgid
|
||||
)
|
||||
@ -440,7 +440,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -455,7 +455,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
new_data['schema'] = schema
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -466,7 +466,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# We need cfgid to add object in tree at browser,
|
||||
# Below sql will give the same
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
name=data['name'],
|
||||
scid=data['schema']
|
||||
)
|
||||
@ -510,7 +510,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
if cfgid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
cfgid=cfgid,
|
||||
scid=data['schema'] if 'schema' in data else scid
|
||||
)
|
||||
@ -583,7 +583,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Drop FTS Configuration
|
||||
result = res['rows'][0]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
name=result['name'],
|
||||
schema=result['schema'],
|
||||
cascade=cascade
|
||||
@ -658,7 +658,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
'schema' in new_data
|
||||
):
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn
|
||||
)
|
||||
@ -689,7 +689,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Fetch sql for update
|
||||
if cfgid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
cfgid=cfgid,
|
||||
scid=scid
|
||||
)
|
||||
@ -707,7 +707,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# If user has changed the schema then fetch new schema directly
|
||||
# using its oid otherwise fetch old schema name using its oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data)
|
||||
|
||||
status, new_schema = self.conn.execute_scalar(sql)
|
||||
@ -720,7 +720,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Fetch old schema name using old schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=old_data
|
||||
)
|
||||
|
||||
@ -732,7 +732,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
old_data['schema'] = old_schema
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=new_data, o_data=old_data
|
||||
)
|
||||
# Fetch sql query for modified data
|
||||
@ -743,7 +743,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
else:
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data
|
||||
)
|
||||
|
||||
@ -936,7 +936,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = {'schema': scid}
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -1007,7 +1007,7 @@ class FtsConfigurationView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, fts_cfg = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -49,8 +49,8 @@ class FtsDictionaryModule(SchemaChildModule):
|
||||
- Load the module script for FTS Dictionary, when any of the schema
|
||||
node is initialized.
|
||||
"""
|
||||
NODE_TYPE = 'fts_dictionary'
|
||||
COLLECTION_LABEL = _('FTS Dictionaries')
|
||||
_NODE_TYPE = 'fts_dictionary'
|
||||
_COLLECTION_LABEL = _('FTS Dictionaries')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -82,7 +82,7 @@ class FtsDictionaryModule(SchemaChildModule):
|
||||
Load the module script for fts template, when any of the schema
|
||||
node is initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = FtsDictionaryModule(__name__)
|
||||
@ -259,7 +259,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -290,7 +290,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -325,7 +325,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
dcid=dcid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -376,7 +376,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
dcid=dcid
|
||||
)
|
||||
@ -439,7 +439,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -453,7 +453,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
new_data = data.copy()
|
||||
new_data['schema'] = schema
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -464,7 +464,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# We need dcid to add object in tree at browser,
|
||||
# Below sql will give the same
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
name=data['name'],
|
||||
scid=data['schema']
|
||||
)
|
||||
@ -508,7 +508,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
if dcid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
dcid=dcid
|
||||
)
|
||||
|
||||
@ -559,7 +559,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
for dcid in data['ids']:
|
||||
# Get name for FTS Dictionary from dcid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
dcid=dcid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -579,7 +579,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Drop FTS Dictionary
|
||||
result = res['rows'][0]
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=result['name'],
|
||||
schema=result['schema'],
|
||||
cascade=cascade
|
||||
@ -655,7 +655,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
'schema' in new_data
|
||||
):
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn
|
||||
)
|
||||
@ -694,7 +694,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Fetch sql for update
|
||||
if dcid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
dcid=dcid,
|
||||
scid=scid
|
||||
)
|
||||
@ -711,7 +711,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# If user has changed the schema then fetch new schema directly
|
||||
# using its oid otherwise fetch old schema name using its oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data)
|
||||
|
||||
status, new_schema = self.conn.execute_scalar(sql)
|
||||
@ -725,7 +725,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Fetch old schema name using old schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=old_data)
|
||||
|
||||
status, old_schema = self.conn.execute_scalar(sql)
|
||||
@ -736,7 +736,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
old_data['schema'] = old_schema
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=new_data, o_data=old_data
|
||||
)
|
||||
# Fetch sql query for modified data
|
||||
@ -746,8 +746,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return sql.strip('\n'), old_data['name']
|
||||
else:
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path, 'schema.sql']),
|
||||
data=data)
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._SCHEMA_SQL]), data=data)
|
||||
|
||||
status, schema = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
@ -805,7 +805,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
dcid=dcid
|
||||
)
|
||||
@ -837,7 +837,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join(
|
||||
[self.template_path, 'schema.sql']), data=res['rows'][0])
|
||||
[self.template_path, self._SCHEMA_SQL]), data=res['rows'][0])
|
||||
|
||||
status, schema = self.conn.execute_scalar(sql)
|
||||
|
||||
@ -850,7 +850,8 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if diff_schema:
|
||||
res['rows'][0]['schema'] = diff_schema
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=res['rows'][0],
|
||||
conn=self.conn, is_displaying=True)
|
||||
|
||||
@ -918,7 +919,7 @@ class FtsDictionaryView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -45,8 +45,8 @@ class FtsParserModule(SchemaChildModule):
|
||||
- Load the module script for FTS Parser, when any of the schema node is
|
||||
initialized.
|
||||
"""
|
||||
NODE_TYPE = 'fts_parser'
|
||||
COLLECTION_LABEL = _('FTS Parsers')
|
||||
_NODE_TYPE = 'fts_parser'
|
||||
_COLLECTION_LABEL = _('FTS Parsers')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FtsParserModule, self).__init__(*args, **kwargs)
|
||||
@ -75,7 +75,7 @@ class FtsParserModule(SchemaChildModule):
|
||||
Load the module script for fts template, when any of the schema node is
|
||||
initialized.
|
||||
"""
|
||||
return DatabaseModule.NODE_TYPE
|
||||
return DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = FtsParserModule(__name__)
|
||||
@ -243,7 +243,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
@check_precondition
|
||||
def list(self, gid, sid, did, scid):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -260,7 +260,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
def nodes(self, gid, sid, did, scid):
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -284,7 +284,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
@check_precondition
|
||||
def node(self, gid, sid, did, scid, pid):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
pid=pid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -334,7 +334,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
pid=pid
|
||||
)
|
||||
@ -385,7 +385,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -399,7 +399,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
new_data = data.copy()
|
||||
new_data['schema'] = schema
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -410,7 +410,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# we need fts_parser id to to add object in tree at browser,
|
||||
# below sql will give the same
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
name=data['name'],
|
||||
scid=data['schema'] if 'schema' in data else scid
|
||||
)
|
||||
@ -453,7 +453,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
if pid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
pid=pid,
|
||||
scid=data['schema'] if 'schema' in data else scid
|
||||
)
|
||||
@ -505,7 +505,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
for pid in data['ids']:
|
||||
# Get name for Parser from pid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
pid=pid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -525,7 +525,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Drop fts Parser
|
||||
result = res['rows'][0]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
name=result['name'],
|
||||
schema=result['schema'],
|
||||
cascade=cascade
|
||||
@ -613,7 +613,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
'schema' in new_data
|
||||
):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn
|
||||
)
|
||||
@ -634,7 +634,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Fetch sql for update
|
||||
if pid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
pid=pid,
|
||||
scid=scid
|
||||
)
|
||||
@ -652,7 +652,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# If user has changed the schema then fetch new schema directly
|
||||
# using its oid otherwise fetch old schema name with parser oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data)
|
||||
|
||||
status, new_schema = self.conn.execute_scalar(sql)
|
||||
@ -665,7 +665,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Fetch old schema name using old schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=old_data
|
||||
)
|
||||
|
||||
@ -677,7 +677,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
old_data['schema'] = old_schema
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=new_data,
|
||||
o_data=old_data
|
||||
)
|
||||
@ -688,7 +688,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
else:
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data
|
||||
)
|
||||
|
||||
@ -878,7 +878,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = {'schema': scid}
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -949,7 +949,7 @@ class FtsParserView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -49,8 +49,8 @@ class FtsTemplateModule(SchemaChildModule):
|
||||
- Load the module script for FTS Template, when any of the schema node is
|
||||
initialized.
|
||||
"""
|
||||
NODE_TYPE = 'fts_template'
|
||||
COLLECTION_LABEL = gettext('FTS Templates')
|
||||
_NODE_TYPE = 'fts_template'
|
||||
_COLLECTION_LABEL = gettext('FTS Templates')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -81,7 +81,7 @@ class FtsTemplateModule(SchemaChildModule):
|
||||
Load the module script for fts template, when any of the schema node is
|
||||
initialized.
|
||||
"""
|
||||
return DatabaseModule.NODE_TYPE
|
||||
return DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = FtsTemplateModule(__name__)
|
||||
@ -221,7 +221,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
@check_precondition
|
||||
def list(self, gid, sid, did, scid):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -238,7 +238,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
def nodes(self, gid, sid, did, scid):
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -262,7 +262,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
@check_precondition
|
||||
def node(self, gid, sid, did, scid, tid):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tid=tid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -312,7 +312,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
tid=tid
|
||||
)
|
||||
@ -358,7 +358,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
).format(arg)
|
||||
)
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path, 'schema.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -371,7 +372,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# to generate proper sql query
|
||||
new_data = data.copy()
|
||||
new_data['schema'] = schema
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -382,7 +384,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# we need fts_template id to to add object in tree at browser,
|
||||
# below sql will give the same
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
name=data['name'],
|
||||
scid=data['schema'] if 'schema' in data else scid
|
||||
)
|
||||
@ -424,7 +426,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tid=tid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -469,7 +471,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
for tid in data['ids']:
|
||||
# Get name for template from tid
|
||||
sql = render_template("/".join([self.template_path, 'delete.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._DELETE_SQL]),
|
||||
tid=tid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -488,7 +491,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Drop fts template
|
||||
result = res['rows'][0]
|
||||
sql = render_template("/".join([self.template_path, 'delete.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._DELETE_SQL]),
|
||||
name=result['name'],
|
||||
schema=result['schema'],
|
||||
cascade=cascade
|
||||
@ -556,7 +560,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# Fetch old schema name using old schema oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=old_data)
|
||||
|
||||
status, old_schema = self.conn.execute_scalar(sql)
|
||||
@ -584,7 +588,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
'schema' in new_data
|
||||
):
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=new_data,
|
||||
conn=self.conn
|
||||
)
|
||||
@ -606,7 +610,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Fetch sql for update
|
||||
if tid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid,
|
||||
scid=scid
|
||||
)
|
||||
@ -627,7 +631,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# using its oid otherwise fetch old schema name using
|
||||
# fts template oid
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'schema.sql']),
|
||||
"/".join([self.template_path, self._SCHEMA_SQL]),
|
||||
data=data)
|
||||
|
||||
status, new_schema = self.conn.execute_scalar(sql)
|
||||
@ -644,7 +648,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=errmsg)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=new_data, o_data=old_data
|
||||
)
|
||||
|
||||
@ -654,7 +658,8 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return sql.strip('\n'), old_data['name']
|
||||
else:
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path, 'schema.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._SCHEMA_SQL]),
|
||||
data=data)
|
||||
|
||||
status, schema = self.conn.execute_scalar(sql)
|
||||
@ -762,7 +767,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = {'schema': scid}
|
||||
# Fetch schema name from schema oid
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'schema.sql']),
|
||||
self._SCHEMA_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -829,7 +834,7 @@ class FtsTemplateView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -61,8 +61,8 @@ class FunctionModule(SchemaChildModule):
|
||||
- Returns a snippet of css.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'function'
|
||||
COLLECTION_LABEL = gettext("Functions")
|
||||
_NODE_TYPE = 'function'
|
||||
_COLLECTION_LABEL = gettext("Functions")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -99,7 +99,7 @@ class FunctionModule(SchemaChildModule):
|
||||
Load the module script for Functions, when the
|
||||
schema node is initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -383,7 +383,8 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
scid: Schema Id
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.sql_template_path, 'node.sql']),
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
self._NODE_SQL]),
|
||||
scid=scid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -408,7 +409,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.sql_template_path, 'node.sql']),
|
||||
"/".join([self.sql_template_path, self._NODE_SQL]),
|
||||
scid=scid,
|
||||
fnid=fnid
|
||||
)
|
||||
@ -852,7 +853,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
sql = render_template(
|
||||
"/".join(
|
||||
[self.sql_template_path, 'get_oid.sql']
|
||||
[self.sql_template_path, self._OID_SQL]
|
||||
),
|
||||
nspname=self.request['pronamespace'],
|
||||
name=self.request['name']
|
||||
@ -903,7 +904,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
for fnid in data['ids']:
|
||||
# Fetch Name and Schema Name to delete the Function.
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
'delete.sql']), scid=scid,
|
||||
self._DELETE_SQL]), scid=scid,
|
||||
fnid=fnid)
|
||||
status, res = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -920,7 +921,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
name=res['rows'][0]['name'],
|
||||
func_args=res['rows'][0]['func_args'],
|
||||
nspname=res['rows'][0]['nspname'],
|
||||
@ -1148,7 +1149,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
# func_def is procedure signature with default arguments
|
||||
# query_for - To distinguish the type of call
|
||||
func_def = render_template("/".join([self.sql_template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=resp_data, query_type="create",
|
||||
func_def=name_with_default_args,
|
||||
query_for="sql_panel")
|
||||
@ -1185,7 +1186,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
# func_def is function signature with default arguments
|
||||
# query_for - To distinguish the type of call
|
||||
func_def = render_template("/".join([self.sql_template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=resp_data, query_type="create",
|
||||
func_def=name_with_default_args,
|
||||
query_for="sql_panel")
|
||||
@ -1427,7 +1428,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
self.reformat_prosrc_code(data)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.sql_template_path, 'update.sql']),
|
||||
"/".join([self.sql_template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
return sql
|
||||
@ -1496,7 +1497,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
# Create mode
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, is_sql=is_sql)
|
||||
return True, sql.strip('\n')
|
||||
|
||||
@ -1514,7 +1515,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, fnid=fnid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -1533,7 +1534,8 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
resp_data.update(frmtd_proargs)
|
||||
|
||||
# Fetch privileges
|
||||
sql = render_template("/".join([self.sql_template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
self._ACL_SQL]),
|
||||
fnid=fnid)
|
||||
status, proaclres = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -1896,7 +1898,7 @@ class FunctionView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
if not oid:
|
||||
sql = render_template("/".join([self.sql_template_path,
|
||||
'node.sql']), scid=scid)
|
||||
self._NODE_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -1939,8 +1941,8 @@ class ProcedureModule(SchemaChildModule):
|
||||
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'procedure'
|
||||
COLLECTION_LABEL = gettext("Procedures")
|
||||
_NODE_TYPE = 'procedure'
|
||||
_COLLECTION_LABEL = gettext("Procedures")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -1978,7 +1980,7 @@ class ProcedureModule(SchemaChildModule):
|
||||
Load the module script for Procedures, when the
|
||||
database node is initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
|
||||
procedure_blueprint = ProcedureModule(__name__)
|
||||
@ -2040,8 +2042,8 @@ class TriggerFunctionModule(SchemaChildModule):
|
||||
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'trigger_function'
|
||||
COLLECTION_LABEL = gettext("Trigger Functions")
|
||||
_NODE_TYPE = 'trigger_function'
|
||||
_COLLECTION_LABEL = gettext("Trigger Functions")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -2077,7 +2079,7 @@ class TriggerFunctionModule(SchemaChildModule):
|
||||
Load the module script for Trigger function, when the
|
||||
schema node is initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
|
||||
trigger_function_blueprint = TriggerFunctionModule(__name__)
|
||||
|
@ -53,8 +53,8 @@ class PackageModule(SchemaChildModule):
|
||||
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'package'
|
||||
COLLECTION_LABEL = _("Packages")
|
||||
_NODE_TYPE = 'package'
|
||||
_COLLECTION_LABEL = _("Packages")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(PackageModule, self).__init__(*args, **kwargs)
|
||||
@ -74,7 +74,7 @@ class PackageModule(SchemaChildModule):
|
||||
Load the module script for schema, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
|
||||
blueprint = PackageModule(__name__)
|
||||
@ -172,7 +172,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -201,7 +202,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
scid=scid,
|
||||
pkgid=pkgid
|
||||
)
|
||||
@ -256,7 +257,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, pkgid=pkgid
|
||||
)
|
||||
status, rset = self.conn.execute_dict(sql)
|
||||
@ -314,7 +315,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:param pkgid:
|
||||
:return:
|
||||
"""
|
||||
sql = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, pkgid=pkgid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -331,7 +333,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res['rows'][0]['pkgbodysrc'] = self.get_inner(
|
||||
res['rows'][0]['pkgbodysrc'])
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
scid=scid,
|
||||
pkgid=pkgid)
|
||||
status, rset1 = self.conn.execute_dict(sql)
|
||||
@ -390,7 +392,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# We need oid of newly created package.
|
||||
sql = render_template(
|
||||
"/".join([
|
||||
self.template_path, 'get_oid.sql'
|
||||
self.template_path, self._OID_SQL
|
||||
]),
|
||||
name=data['name'], scid=scid
|
||||
)
|
||||
@ -444,7 +446,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
for pkgid in data['ids']:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
pkgid=pkgid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -465,7 +467,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res['rows'][0]['schema'] = self.schema
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=res['rows'][0],
|
||||
cascade=cascade)
|
||||
|
||||
@ -596,7 +598,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if 'pkgacl' in data:
|
||||
data['pkgacl'] = parse_priv_to_db(data['pkgacl'], self.acl)
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
|
||||
return sql, data['name']
|
||||
@ -620,7 +623,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
u'name'
|
||||
]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']), scid=scid,
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]), scid=scid,
|
||||
pkgid=pkgid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -635,7 +638,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res['rows'][0]['pkgbodysrc'] = self.get_inner(
|
||||
res['rows'][0]['pkgbodysrc'])
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
scid=scid,
|
||||
pkgid=pkgid)
|
||||
|
||||
@ -660,7 +663,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if arg not in data:
|
||||
data[arg] = old_data[arg]
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'update.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn,
|
||||
is_schema_diff=diff_schema)
|
||||
return sql, data['name'] if 'name' in data else old_data['name']
|
||||
@ -684,8 +688,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
try:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']), scid=scid,
|
||||
pkgid=pkgid)
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, pkgid=pkgid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -699,7 +703,8 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res['rows'][0]['pkgbodysrc'] = self.get_inner(
|
||||
res['rows'][0]['pkgbodysrc'])
|
||||
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._ACL_SQL]),
|
||||
scid=scid,
|
||||
pkgid=pkgid)
|
||||
status, rset1 = self.conn.execute_dict(sql)
|
||||
@ -728,7 +733,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self.schema, result['name'])
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=result)
|
||||
sql_header += "\n\n"
|
||||
|
||||
@ -812,7 +817,7 @@ class PackageView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return res
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -55,8 +55,8 @@ class EdbFuncModule(CollectionNodeModule):
|
||||
- Returns a snippet of css.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'edbfunc'
|
||||
COLLECTION_LABEL = gettext("Functions")
|
||||
_NODE_TYPE = 'edbfunc'
|
||||
_COLLECTION_LABEL = gettext("Functions")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -83,7 +83,7 @@ class EdbFuncModule(CollectionNodeModule):
|
||||
Load the module script for Functions, when the
|
||||
package node is initialized.
|
||||
"""
|
||||
return packages.PackageModule.NODE_TYPE
|
||||
return packages.PackageModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -246,7 +246,8 @@ class EdbFuncView(PGChildNodeView, DataTypeReader):
|
||||
scid: Schema Id
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.sql_template_path, 'node.sql']),
|
||||
SQL = render_template("/".join([self.sql_template_path,
|
||||
self._NODE_SQL]),
|
||||
pkgid=pkgid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -271,7 +272,7 @@ class EdbFuncView(PGChildNodeView, DataTypeReader):
|
||||
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.sql_template_path, 'node.sql']),
|
||||
"/".join([self.sql_template_path, self._NODE_SQL]),
|
||||
pkgid=pkgid,
|
||||
fnid=edbfnid
|
||||
)
|
||||
@ -326,7 +327,7 @@ class EdbFuncView(PGChildNodeView, DataTypeReader):
|
||||
edbfnid: Function Id
|
||||
"""
|
||||
SQL = render_template("/".join([self.sql_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
pkgid=pkgid, edbfnid=edbfnid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -618,8 +619,8 @@ class EdbProcModule(CollectionNodeModule):
|
||||
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'edbproc'
|
||||
COLLECTION_LABEL = gettext("Procedures")
|
||||
_NODE_TYPE = 'edbproc'
|
||||
_COLLECTION_LABEL = gettext("Procedures")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -655,7 +656,7 @@ class EdbProcModule(CollectionNodeModule):
|
||||
Load the module script for Procedures, when the
|
||||
database node is initialized.
|
||||
"""
|
||||
return packages.PackageModule.NODE_TYPE
|
||||
return packages.PackageModule.node_type
|
||||
|
||||
def register_preferences(self):
|
||||
"""
|
||||
|
@ -52,8 +52,8 @@ class EdbVarModule(CollectionNodeModule):
|
||||
- Returns a snippet of css.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'edbvar'
|
||||
COLLECTION_LABEL = gettext("Variables")
|
||||
_NODE_TYPE = 'edbvar'
|
||||
_COLLECTION_LABEL = gettext("Variables")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -80,7 +80,7 @@ class EdbVarModule(CollectionNodeModule):
|
||||
Load the module script for Functions, when the
|
||||
package node is initialized.
|
||||
"""
|
||||
return packages.PackageModule.NODE_TYPE
|
||||
return packages.PackageModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -209,7 +209,8 @@ class EdbVarView(PGChildNodeView, DataTypeReader):
|
||||
pkgid: Package Id
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.sql_template_path, 'node.sql']),
|
||||
SQL = render_template("/".join([self.sql_template_path,
|
||||
self._NODE_SQL]),
|
||||
pkgid=pkgid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -235,7 +236,7 @@ class EdbVarView(PGChildNodeView, DataTypeReader):
|
||||
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.sql_template_path, 'node.sql']),
|
||||
"/".join([self.sql_template_path, self._NODE_SQL]),
|
||||
pkgid=pkgid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -272,7 +273,7 @@ class EdbVarView(PGChildNodeView, DataTypeReader):
|
||||
"""
|
||||
resp_data = {}
|
||||
SQL = render_template("/".join([self.sql_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
pkgid=pkgid, varid=varid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -304,7 +305,7 @@ class EdbVarView(PGChildNodeView, DataTypeReader):
|
||||
varid: variable Id
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.sql_template_path, 'properties.sql']),
|
||||
"/".join([self.sql_template_path, self._PROPERTIES_SQL]),
|
||||
varid=varid,
|
||||
pkgid=pkgid)
|
||||
|
||||
|
@ -52,8 +52,8 @@ class SequenceModule(SchemaChildModule):
|
||||
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'sequence'
|
||||
COLLECTION_LABEL = _("Sequences")
|
||||
_NODE_TYPE = 'sequence'
|
||||
_COLLECTION_LABEL = _("Sequences")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(SequenceModule, self).__init__(*args, **kwargs)
|
||||
@ -73,7 +73,7 @@ class SequenceModule(SchemaChildModule):
|
||||
Load the module script for database, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -167,7 +167,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -198,7 +198,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
scid=scid,
|
||||
seid=seid
|
||||
)
|
||||
@ -295,7 +295,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, seid=seid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -329,7 +329,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
self._add_securities_to_row(row)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'acl.sql']),
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
scid=scid, seid=seid
|
||||
)
|
||||
status, dataclres = self.conn.execute_dict(sql)
|
||||
@ -394,7 +394,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
# The SQL below will execute CREATE DDL only
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
except Exception as e:
|
||||
@ -410,7 +410,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# The SQL below will execute rest DMLs because we cannot execute
|
||||
# CREATE with any other
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
sql = sql.strip('\n').strip(' ')
|
||||
@ -421,7 +421,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# We need oid of newly created sequence.
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
name=data['name'],
|
||||
schema=data['schema']
|
||||
)
|
||||
@ -474,7 +474,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
for seid in data['ids']:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, seid=seid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -493,7 +493,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=res['rows'][0], cascade=cascade
|
||||
)
|
||||
|
||||
@ -542,7 +542,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
seid=seid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -631,7 +631,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
if seid is not None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, seid=seid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -652,7 +652,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if arg not in data:
|
||||
data[arg] = old_data[arg]
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
return sql, data['name'] if 'name' in data else old_data['name']
|
||||
@ -662,11 +662,11 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data['relacl'] = parse_priv_to_db(data['relacl'], self.acl)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
sql += render_template(
|
||||
"/".join([self.template_path, 'grant.sql']),
|
||||
"/".join([self.template_path, self._GRANT_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
return sql, data['name']
|
||||
@ -706,7 +706,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid, seid=seid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -780,7 +780,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data['securities'] = seclabels
|
||||
|
||||
# We need to parse & convert ACL coming from database to json format
|
||||
sql = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
scid=scid, seid=seid)
|
||||
status, acl = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -928,7 +928,7 @@ class SequenceView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -49,8 +49,8 @@ class SynonymModule(SchemaChildModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'synonym'
|
||||
COLLECTION_LABEL = gettext("Synonyms")
|
||||
_NODE_TYPE = 'synonym'
|
||||
_COLLECTION_LABEL = gettext("Synonyms")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -78,7 +78,7 @@ class SynonymModule(SchemaChildModule):
|
||||
Load the module script for database, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -233,7 +233,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), scid=scid)
|
||||
self._PROPERTIES_SQL]), scid=scid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -262,7 +262,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -295,7 +295,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
syid=syid, scid=scid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
@ -409,7 +409,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
try:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, syid=syid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -458,7 +458,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
try:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, comment=False)
|
||||
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
@ -512,7 +512,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
for syid in data['ids']:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, syid=syid)
|
||||
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -528,7 +528,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data,
|
||||
conn=self.conn)
|
||||
if only_sql:
|
||||
@ -622,7 +622,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
name = None
|
||||
if syid is not None:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, syid=syid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -641,7 +641,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data['synobjname'] = old_data['synobjname']
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
else:
|
||||
@ -655,7 +655,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
name = data['name']
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']), comment=False,
|
||||
self._CREATE_SQL]), comment=False,
|
||||
data=data, conn=self.conn)
|
||||
return SQL.strip('\n'), name
|
||||
|
||||
@ -677,7 +677,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
json_resp = kwargs.get('json_resp', True)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, syid=syid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -694,7 +694,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data['schema'] = diff_schema
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, comment=True)
|
||||
if not json_resp:
|
||||
return SQL
|
||||
@ -757,7 +757,7 @@ class SynonymView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return res
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), scid=scid)
|
||||
self._PROPERTIES_SQL]), scid=scid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
|
@ -53,8 +53,8 @@ class TableModule(SchemaChildModule):
|
||||
- Load the module script for schema, when any of the server node is
|
||||
initialized.
|
||||
"""
|
||||
NODE_TYPE = 'table'
|
||||
COLLECTION_LABEL = gettext("Tables")
|
||||
_NODE_TYPE = 'table'
|
||||
_COLLECTION_LABEL = gettext("Tables")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -80,7 +80,7 @@ class TableModule(SchemaChildModule):
|
||||
Load the module script for database, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -304,7 +304,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
JSON of available table nodes
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -357,7 +357,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'nodes.sql']),
|
||||
"/".join([self.table_template_path, self._NODES_SQL]),
|
||||
scid=scid, tid=tid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -401,7 +401,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'nodes.sql']),
|
||||
"/".join([self.table_template_path, self._NODES_SQL]),
|
||||
scid=scid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -626,7 +626,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
:return:
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -993,7 +993,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
BaseTableView.update_vacuum_settings(self, 'vacuum_toast', data)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.table_template_path, 'create.sql']),
|
||||
"/".join([self.table_template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
|
||||
@ -1024,7 +1024,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
# we need oid to to add object in tree at browser
|
||||
sql = render_template(
|
||||
"/".join([self.table_template_path, 'get_oid.sql']),
|
||||
"/".join([self.table_template_path, self._OID_SQL]),
|
||||
scid=new_scid, data=data
|
||||
)
|
||||
|
||||
@ -1103,7 +1103,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
try:
|
||||
for tid in data['ids']:
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1151,7 +1151,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
try:
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1190,7 +1190,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
try:
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1258,7 +1258,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
main_sql = []
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1404,7 +1404,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
SELECT Script sql for the object
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1452,7 +1452,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
INSERT Script sql for the object
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1503,7 +1503,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
UPDATE Script sql for the object
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1556,7 +1556,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
DELETE Script sql for the object
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.table_template_path, 'properties.sql']),
|
||||
"/".join([self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1636,7 +1636,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
@BaseTableView.check_precondition
|
||||
def get_drop_sql(self, sid, did, scid, tid):
|
||||
SQL = render_template("/".join(
|
||||
[self.table_template_path, 'properties.sql']),
|
||||
[self.table_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1686,7 +1686,7 @@ class TableView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
else:
|
||||
res = dict()
|
||||
sql = render_template("/".join([self.table_template_path,
|
||||
'nodes.sql']), scid=scid)
|
||||
self._NODES_SQL]), scid=scid)
|
||||
status, tables = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
current_app.logger.error(tables)
|
||||
|
@ -52,8 +52,8 @@ class ColumnsModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'column'
|
||||
COLLECTION_LABEL = gettext("Columns")
|
||||
_NODE_TYPE = 'column'
|
||||
_COLLECTION_LABEL = gettext("Columns")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -82,7 +82,7 @@ class ColumnsModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -239,7 +239,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
"""
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, show_sys_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -269,7 +269,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tid=tid,
|
||||
clid=clid,
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
@ -328,7 +328,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
"""
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, clid=clid,
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
@ -406,7 +406,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
data = column_utils.convert_length_precision_to_string(data)
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -455,7 +455,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
try:
|
||||
for clid in data['ids']:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, clid=clid,
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
@ -481,7 +481,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
data['table'] = self.table
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -591,7 +591,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
|
||||
if clid is not None:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, clid=clid,
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
@ -647,7 +647,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
)
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
else:
|
||||
@ -667,7 +667,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
self.acl)
|
||||
# If the request for new object which do not have did
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, is_sql=is_sql
|
||||
)
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
@ -687,7 +687,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
"""
|
||||
try:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, clid=clid,
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
@ -728,7 +728,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
)
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
SQL = sql_header + '\n\n' + SQL
|
||||
@ -839,7 +839,7 @@ class ColumnsView(PGChildNodeView, DataTypeReader):
|
||||
"""
|
||||
# Fetch column name
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, clid=clid,
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
)
|
||||
|
@ -55,8 +55,8 @@ class CompoundTriggerModule(CollectionNodeModule):
|
||||
node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'compound_trigger'
|
||||
COLLECTION_LABEL = gettext("Compound Triggers")
|
||||
_NODE_TYPE = 'compound_trigger'
|
||||
_COLLECTION_LABEL = gettext("Compound Triggers")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -118,7 +118,7 @@ class CompoundTriggerModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -313,7 +313,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), tid=tid)
|
||||
self._PROPERTIES_SQL]), tid=tid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -343,7 +343,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid,
|
||||
trid=trid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -388,7 +388,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -445,7 +445,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
def _fetch_properties(self, tid, trid):
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -515,7 +515,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
try:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -523,7 +523,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# we need oid to to add object in tree at browser
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
tid=tid, data=data)
|
||||
status, trid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -576,7 +576,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# current request so that we create template for
|
||||
# dropping compound trigger
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -599,7 +599,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = dict(res['rows'][0])
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
cascade=cascade
|
||||
@ -653,7 +653,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# update the compound trigger then new OID is getting generated
|
||||
# so we need to return new OID of compound trigger.
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid, data=data
|
||||
)
|
||||
status, new_trid = self.conn.execute_scalar(SQL)
|
||||
@ -661,7 +661,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=new_trid)
|
||||
# Fetch updated properties
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=new_trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -783,7 +783,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -906,7 +906,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
trid=oid, only_sql=True)
|
||||
else:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=oid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -971,7 +971,7 @@ class CompoundTriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res = data
|
||||
else:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, triggers = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
current_app.logger.error(triggers)
|
||||
|
@ -47,8 +47,8 @@ class ConstraintsModule(CollectionNodeModule):
|
||||
node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'constraints'
|
||||
COLLECTION_LABEL = gettext("Constraints")
|
||||
_NODE_TYPE = 'constraints'
|
||||
_COLLECTION_LABEL = gettext("Constraints")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -73,7 +73,7 @@ class ConstraintsModule(CollectionNodeModule):
|
||||
Load the module script for constraints, when any of the table node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
|
@ -48,8 +48,8 @@ class CheckConstraintModule(CollectionNodeModule):
|
||||
- Load the module script for the Check Constraint, when any of the
|
||||
Check node is initialized.
|
||||
"""
|
||||
NODE_TYPE = 'check_constraint'
|
||||
COLLECTION_LABEL = _("Check Constraints")
|
||||
_NODE_TYPE = 'check_constraint'
|
||||
_COLLECTION_LABEL = _("Check Constraints")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(CheckConstraintModule, self).__init__(*args, **kwargs)
|
||||
@ -75,7 +75,7 @@ class CheckConstraintModule(CollectionNodeModule):
|
||||
Load the module script for the Check Constraint, when any of the
|
||||
Check node is initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -272,8 +272,8 @@ class CheckConstraintView(PGChildNodeView):
|
||||
self.schema = schema
|
||||
self.table = table
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
tid=tid)
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]), tid=tid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
for row in res['rows']:
|
||||
@ -295,7 +295,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
cid: Check constraint Id.
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid,
|
||||
cid=cid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -337,7 +337,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -391,7 +391,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -506,7 +506,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
|
||||
# The below SQL will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data
|
||||
)
|
||||
|
||||
@ -533,7 +533,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
|
||||
else:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid,
|
||||
name=data['name']
|
||||
)
|
||||
@ -591,7 +591,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
try:
|
||||
for cid in data['ids']:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, cid=cid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -613,7 +613,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
data = res['rows'][0]
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -698,7 +698,7 @@ class CheckConstraintView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, cid=cid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -713,13 +713,13 @@ class CheckConstraintView(PGChildNodeView):
|
||||
data['table'] = self.table
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data)
|
||||
|
||||
sql_header = u"-- Constraint: {0}\n\n-- ".format(data['name'])
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data)
|
||||
sql_header += "\n"
|
||||
|
||||
|
@ -50,8 +50,8 @@ class ExclusionConstraintModule(ConstraintTypeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'exclusion_constraint'
|
||||
COLLECTION_LABEL = _("Exclusion Constraints")
|
||||
_NODE_TYPE = 'exclusion_constraint'
|
||||
_COLLECTION_LABEL = _("Exclusion Constraints")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -92,7 +92,7 @@ class ExclusionConstraintModule(ConstraintTypeModule):
|
||||
|
||||
Returns: node type of the server module.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -336,7 +336,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
self.table = table
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did,
|
||||
tid=tid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -365,7 +365,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid,
|
||||
exid=exid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -403,7 +403,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -448,7 +448,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -520,7 +520,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
|
||||
# The below SQL will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
@ -545,7 +545,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
|
||||
else:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
name=data['name']
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -605,7 +605,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
name=data['name']
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -680,7 +680,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
data['table'] = self.table
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data,
|
||||
cascade=cascade)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
@ -761,7 +761,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
"""
|
||||
try:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, tid=tid, conn=self.conn, cid=exid)
|
||||
status, result = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -818,12 +818,12 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
data['amname'] = 'btree'
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']), data=data)
|
||||
"/".join([self.template_path, self._CREATE_SQL]), data=data)
|
||||
|
||||
sql_header = u"-- Constraint: {0}\n\n-- ".format(data['name'])
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data)
|
||||
sql_header += "\n"
|
||||
|
||||
@ -863,7 +863,7 @@ class ExclusionConstraintView(PGChildNodeView):
|
||||
if is_pgstattuple:
|
||||
# Fetch index details only if extended stats available
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, tid=tid, conn=self.conn, cid=exid)
|
||||
status, result = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
|
@ -52,8 +52,8 @@ class ForeignKeyConstraintModule(ConstraintTypeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'foreign_key'
|
||||
COLLECTION_LABEL = gettext("Foreign Keys")
|
||||
_NODE_TYPE = 'foreign_key'
|
||||
_COLLECTION_LABEL = gettext("Foreign Keys")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -94,7 +94,7 @@ class ForeignKeyConstraintModule(ConstraintTypeModule):
|
||||
|
||||
Returns: node type of the server module.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -346,7 +346,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
self.table = table
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -373,7 +373,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']), tid=tid
|
||||
"/".join([self.template_path, self._NODES_SQL]), tid=tid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -418,7 +418,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
res = []
|
||||
@ -458,7 +458,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
|
||||
@ -543,7 +543,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
|
||||
# The below SQL will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
@ -568,7 +568,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
|
||||
else:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
name=data['name']
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -647,7 +647,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid,
|
||||
name=data['name']
|
||||
)
|
||||
@ -727,7 +727,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
data['table'] = self.table
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data, cascade=cascade)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
if not status:
|
||||
@ -806,7 +806,7 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tid=tid, conn=self.conn, cid=fkid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -844,12 +844,12 @@ class ForeignKeyConstraintView(PGChildNodeView):
|
||||
data['remote_table'] = table
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']), data=data)
|
||||
"/".join([self.template_path, self._CREATE_SQL]), data=data)
|
||||
|
||||
sql_header = u"-- Constraint: {0}\n\n-- ".format(data['name'])
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data)
|
||||
sql_header += "\n"
|
||||
|
||||
|
@ -50,8 +50,8 @@ class IndexConstraintModule(ConstraintTypeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'index_constraint'
|
||||
COLLECTION_LABEL = _('Index constraint')
|
||||
_NODE_TYPE = 'index_constraint'
|
||||
_COLLECTION_LABEL = _('Index constraint')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -92,7 +92,7 @@ class IndexConstraintModule(ConstraintTypeModule):
|
||||
|
||||
Returns: node type of the server module.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -111,8 +111,8 @@ class PrimaryKeyConstraintModule(IndexConstraintModule):
|
||||
IndexConstraintModule.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'primary_key'
|
||||
COLLECTION_LABEL = _("Primary Key")
|
||||
_NODE_TYPE = 'primary_key'
|
||||
_COLLECTION_LABEL = _("Primary Key")
|
||||
|
||||
|
||||
primary_key_blueprint = PrimaryKeyConstraintModule(__name__)
|
||||
@ -126,8 +126,8 @@ class UniqueConstraintModule(IndexConstraintModule):
|
||||
IndexConstraintModule.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'unique_constraint'
|
||||
COLLECTION_LABEL = _("Unique Constraint")
|
||||
_NODE_TYPE = 'unique_constraint'
|
||||
_COLLECTION_LABEL = _("Unique Constraint")
|
||||
|
||||
|
||||
unique_constraint_blueprint = UniqueConstraintModule(__name__)
|
||||
@ -355,8 +355,8 @@ class IndexConstraintView(PGChildNodeView):
|
||||
self.schema = schema
|
||||
self.table = table
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'properties.sql']),
|
||||
did=did,
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._PROPERTIES_SQL]), did=did,
|
||||
tid=tid,
|
||||
constraint_type=self.constraint_type)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -382,7 +382,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'nodes.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODES_SQL]),
|
||||
cid=cid,
|
||||
tid=tid,
|
||||
constraint_type=self.constraint_type)
|
||||
@ -425,7 +425,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
Returns:
|
||||
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path, 'nodes.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODES_SQL]),
|
||||
tid=tid,
|
||||
constraint_type=self.constraint_type)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -475,7 +475,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
self.table = table
|
||||
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path, 'nodes.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._NODES_SQL]),
|
||||
tid=tid,
|
||||
constraint_type=self.constraint_type)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -566,7 +566,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
|
||||
# The below SQL will execute CREATE DDL only
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn,
|
||||
constraint_name=self.constraint_name
|
||||
)
|
||||
@ -594,7 +594,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
|
||||
else:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid,
|
||||
constraint_type=self.constraint_type,
|
||||
name=data['name']
|
||||
@ -656,7 +656,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid,
|
||||
constraint_type=self.constraint_type,
|
||||
name=data['name']
|
||||
@ -733,7 +733,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
data['table'] = self.table
|
||||
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data,
|
||||
cascade=cascade)
|
||||
status, res = self.conn.execute_scalar(sql)
|
||||
@ -820,7 +820,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
"""
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did,
|
||||
tid=tid,
|
||||
conn=self.conn,
|
||||
@ -867,14 +867,14 @@ class IndexConstraintView(PGChildNodeView):
|
||||
data['include'] = [col['colname'] for col in res['rows']]
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data,
|
||||
constraint_name=self.constraint_name)
|
||||
|
||||
sql_header = u"-- Constraint: {0}\n\n-- ".format(data['name'])
|
||||
|
||||
sql_header += render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data)
|
||||
sql_header += "\n"
|
||||
|
||||
@ -911,7 +911,7 @@ class IndexConstraintView(PGChildNodeView):
|
||||
if is_pgstattuple:
|
||||
# Fetch index details only if extended stats available
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did,
|
||||
tid=tid,
|
||||
cid=cid,
|
||||
|
@ -53,8 +53,8 @@ class IndexesModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'index'
|
||||
COLLECTION_LABEL = gettext("Indexes")
|
||||
_NODE_TYPE = 'index'
|
||||
_COLLECTION_LABEL = gettext("Indexes")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -113,7 +113,7 @@ class IndexesModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -388,7 +388,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']), tid=tid
|
||||
"/".join([self.template_path, self._NODES_SQL]), tid=tid
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -417,7 +417,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
JSON of available schema child nodes
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tid=tid, idx=idx
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -457,7 +457,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']), tid=tid
|
||||
"/".join([self.template_path, self._NODES_SQL]), tid=tid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -512,7 +512,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, tid=tid, idx=idx, datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
|
||||
@ -608,7 +608,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# Start transaction.
|
||||
self.conn.execute_scalar("BEGIN;")
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, mode='create'
|
||||
)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
@ -633,7 +633,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# we need oid to to add object in tree at browser
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid, data=data
|
||||
)
|
||||
status, idx = self.conn.execute_scalar(SQL)
|
||||
@ -692,7 +692,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# We will first fetch the index name for current request
|
||||
# so that we create template for dropping index
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, tid=tid, idx=idx, datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
|
||||
@ -713,7 +713,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = dict(res['rows'][0])
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
data=data, conn=self.conn, cascade=cascade
|
||||
)
|
||||
|
||||
@ -962,7 +962,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
if is_pgstattuple:
|
||||
# Fetch index details only if extended stats available
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
did=did, tid=tid, idx=idx,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -1021,7 +1021,7 @@ class IndexesView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
if not oid:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, indexes = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
current_app.logger.error(indexes)
|
||||
|
@ -72,8 +72,8 @@ class PartitionsModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'partition'
|
||||
COLLECTION_LABEL = gettext("Partitions")
|
||||
_NODE_TYPE = 'partition'
|
||||
_COLLECTION_LABEL = gettext("Partitions")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -101,7 +101,7 @@ class PartitionsModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return schema.SchemaModule.NODE_TYPE
|
||||
return schema.SchemaModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -139,10 +139,10 @@ class PartitionsModule(CollectionNodeModule):
|
||||
# Exclude 'partition' module for now to avoid cyclic import issue.
|
||||
modules_to_skip = ['partition', 'column']
|
||||
for parent in self.parentmodules:
|
||||
if parent.NODE_TYPE == 'table':
|
||||
if parent.node_type == 'table':
|
||||
self.submodules += [
|
||||
submodule for submodule in parent.submodules
|
||||
if submodule.NODE_TYPE not in modules_to_skip
|
||||
if submodule.node_type not in modules_to_skip
|
||||
]
|
||||
|
||||
@property
|
||||
@ -267,7 +267,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
JSON of available table nodes
|
||||
"""
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -297,7 +297,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
JSON of available table nodes
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.partition_template_path, 'nodes.sql']),
|
||||
"/".join([self.partition_template_path, self._NODES_SQL]),
|
||||
scid=scid, tid=tid, ptid=ptid
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -376,7 +376,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
"""
|
||||
try:
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
ptid=ptid, datlastsysoid=self.datlastsysoid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -412,7 +412,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
if ptid:
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
ptid=ptid, datlastsysoid=self.datlastsysoid)
|
||||
status, result = self.conn.execute_dict(SQL)
|
||||
@ -425,7 +425,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
else:
|
||||
SQL = render_template(
|
||||
"/".join([self.partition_template_path, 'nodes.sql']),
|
||||
"/".join([self.partition_template_path, self._NODES_SQL]),
|
||||
scid=scid, tid=tid
|
||||
)
|
||||
status, partitions = self.conn.execute_2darray(SQL)
|
||||
@ -435,7 +435,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
for row in partitions['rows']:
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
ptid=row['oid'],
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
@ -708,7 +708,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
try:
|
||||
SQL = render_template("/".join([self.partition_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid,
|
||||
ptid=ptid, datlastsysoid=self.datlastsysoid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -745,7 +745,8 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
try:
|
||||
for ptid in data['ids']:
|
||||
SQL = render_template(
|
||||
"/".join([self.partition_template_path, 'properties.sql']),
|
||||
"/".join([self.partition_template_path,
|
||||
self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid, ptid=ptid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
@ -799,7 +800,7 @@ class PartitionsView(BaseTableView, DataTypeReader, VacuumSettings,
|
||||
|
||||
try:
|
||||
SQL = render_template(
|
||||
"/".join([self.partition_template_path, 'properties.sql']),
|
||||
"/".join([self.partition_template_path, self._PROPERTIES_SQL]),
|
||||
did=did, scid=scid, tid=tid, ptid=ptid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
)
|
||||
|
@ -52,8 +52,8 @@ class RowSecurityModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'row_security_policy'
|
||||
COLLECTION_LABEL = gettext('RLS Policies')
|
||||
_NODE_TYPE = 'row_security_policy'
|
||||
_COLLECTION_LABEL = gettext('RLS Policies')
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(RowSecurityModule, self).__init__(*args, **kwargs)
|
||||
@ -84,7 +84,7 @@ class RowSecurityModule(CollectionNodeModule):
|
||||
Load the module script for policy, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -226,7 +226,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
|
||||
# fetch schema name by schema id
|
||||
sql = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']), schema=self.schema,
|
||||
[self.template_path, self._PROPERTIES_SQL]), schema=self.schema,
|
||||
tid=tid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -243,7 +243,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
return single node
|
||||
"""
|
||||
sql = render_template("/".join(
|
||||
[self.template_path, 'nodes.sql']), plid=plid)
|
||||
[self.template_path, self._NODES_SQL]), plid=plid)
|
||||
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -271,7 +271,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
sql = render_template("/".join(
|
||||
[self.template_path, 'nodes.sql']), tid=tid)
|
||||
[self.template_path, self._NODES_SQL]), tid=tid)
|
||||
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -314,7 +314,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
:return:
|
||||
"""
|
||||
sql = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']
|
||||
[self.template_path, self._PROPERTIES_SQL]
|
||||
), plid=plid, scid=scid, datlastsysoid=self.datlastsysoid)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
|
||||
@ -370,7 +370,8 @@ class RowSecurityView(PGChildNodeView):
|
||||
).format(arg)
|
||||
)
|
||||
try:
|
||||
sql = render_template("/".join([self.template_path, 'create.sql']),
|
||||
sql = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
)
|
||||
@ -493,7 +494,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
result['schema'] = self.schema
|
||||
result['table'] = self.table
|
||||
sql = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
policy_name=result['name'],
|
||||
cascade=cascade,
|
||||
result=result
|
||||
@ -652,7 +653,7 @@ class RowSecurityView(PGChildNodeView):
|
||||
|
||||
if not oid:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, policies = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
current_app.logger.error(policies)
|
||||
|
@ -41,8 +41,8 @@ class RuleModule(CollectionNodeModule):
|
||||
script_load - tells when to load js file.
|
||||
csssnppets - add css to page
|
||||
"""
|
||||
NODE_TYPE = 'rule'
|
||||
COLLECTION_LABEL = gettext("Rules")
|
||||
_NODE_TYPE = 'rule'
|
||||
_COLLECTION_LABEL = gettext("Rules")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -97,7 +97,7 @@ class RuleModule(CollectionNodeModule):
|
||||
Load the module script for rule, when any of the database nodes are
|
||||
initialized.
|
||||
"""
|
||||
return schemas.SchemaModule.NODE_TYPE
|
||||
return schemas.SchemaModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -219,7 +219,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# fetch schema name by schema id
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']), tid=tid)
|
||||
[self.template_path, self._PROPERTIES_SQL]), tid=tid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -235,7 +235,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return single node
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'nodes.sql']), rid=rid)
|
||||
[self.template_path, self._NODES_SQL]), rid=rid)
|
||||
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -263,7 +263,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'nodes.sql']), tid=tid)
|
||||
[self.template_path, self._NODES_SQL]), tid=tid)
|
||||
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -305,7 +305,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']
|
||||
[self.template_path, self._PROPERTIES_SQL]
|
||||
), rid=rid, datlastsysoid=self.datlastsysoid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
@ -341,7 +341,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
)
|
||||
try:
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'create.sql']), data=data)
|
||||
[self.template_path, self._CREATE_SQL]), data=data)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -413,7 +413,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
for rid in data['ids']:
|
||||
# Get name for rule from did
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'delete.sql']), rid=rid)
|
||||
[self.template_path, self._DELETE_SQL]), rid=rid)
|
||||
status, res_data = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res_data)
|
||||
@ -432,7 +432,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# drop rule
|
||||
rset = res_data['rows'][0]
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'delete.sql']),
|
||||
[self.template_path, self._DELETE_SQL]),
|
||||
rulename=rset['rulename'],
|
||||
relname=rset['relname'],
|
||||
nspname=rset['nspname'],
|
||||
@ -476,7 +476,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
This function will generate sql to render into the sql panel
|
||||
"""
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']), rid=rid)
|
||||
[self.template_path, self._PROPERTIES_SQL]), rid=rid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -485,7 +485,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
res_data = parse_rule_definition(res)
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'create.sql']),
|
||||
[self.template_path, self._CREATE_SQL]),
|
||||
data=res_data, display_comments=True)
|
||||
|
||||
return ajax_response(response=SQL)
|
||||
@ -497,7 +497,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
if rid is not None:
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']), rid=rid)
|
||||
[self.template_path, self._PROPERTIES_SQL]), rid=rid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -509,12 +509,12 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
old_data = res_data
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
else:
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'create.sql']), data=data)
|
||||
[self.template_path, self._CREATE_SQL]), data=data)
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
|
||||
@check_precondition
|
||||
@ -541,7 +541,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
rid=oid, only_sql=True)
|
||||
else:
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'properties.sql']), rid=oid)
|
||||
[self.template_path, self._PROPERTIES_SQL]), rid=oid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=res)
|
||||
@ -560,7 +560,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
source_schema, diff_schema)
|
||||
old_data = res_data
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
else:
|
||||
@ -573,7 +573,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res_data['schema'] = diff_schema
|
||||
|
||||
SQL = render_template("/".join(
|
||||
[self.template_path, 'create.sql']),
|
||||
[self.template_path, self._CREATE_SQL]),
|
||||
data=res_data, display_comments=True)
|
||||
|
||||
return SQL
|
||||
@ -639,7 +639,7 @@ class RuleView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res = data
|
||||
else:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid)
|
||||
status, rules = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
|
@ -71,7 +71,7 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
||||
source_dict=source_tables,
|
||||
target_dict=target_tables,
|
||||
node=self.node_type,
|
||||
node_label=self.blueprint.COLLECTION_LABEL,
|
||||
node_label=self.blueprint.collection_label,
|
||||
ignore_whitespaces=ignore_whitespaces,
|
||||
ignore_keys=self.keys_to_ignore)
|
||||
|
||||
@ -265,11 +265,11 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
||||
|
||||
# Iterate through all the sub modules of the table
|
||||
for module in self.blueprint.submodules:
|
||||
if module.NODE_TYPE not in ignore_sub_modules:
|
||||
if module.node_type not in ignore_sub_modules:
|
||||
module_view = \
|
||||
SchemaDiffRegistry.get_node_view(module.NODE_TYPE)
|
||||
SchemaDiffRegistry.get_node_view(module.node_type)
|
||||
|
||||
if module.NODE_TYPE == 'partition' and \
|
||||
if module.node_type == 'partition' and \
|
||||
('is_partitioned' in source and source['is_partitioned'])\
|
||||
and ('is_partitioned' in target and
|
||||
target['is_partitioned']):
|
||||
@ -280,9 +280,9 @@ class SchemaDiffTableCompare(SchemaDiffObjectCompare):
|
||||
)
|
||||
|
||||
diff += '\n' + target_ddl
|
||||
elif module.NODE_TYPE != 'partition':
|
||||
dict1 = copy.deepcopy(source[module.NODE_TYPE])
|
||||
dict2 = copy.deepcopy(target[module.NODE_TYPE])
|
||||
elif module.node_type != 'partition':
|
||||
dict1 = copy.deepcopy(source[module.node_type])
|
||||
dict2 = copy.deepcopy(target[module.node_type])
|
||||
|
||||
# Find the duplicate keys in both the dictionaries
|
||||
dict1_keys = set(dict1.keys())
|
||||
|
@ -54,8 +54,8 @@ class TriggerModule(CollectionNodeModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'trigger'
|
||||
COLLECTION_LABEL = gettext("Triggers")
|
||||
_NODE_TYPE = 'trigger'
|
||||
_COLLECTION_LABEL = gettext("Triggers")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -114,7 +114,7 @@ class TriggerModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -349,7 +349,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']), tid=tid)
|
||||
self._PROPERTIES_SQL]), tid=tid)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
|
||||
if not status:
|
||||
@ -379,7 +379,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
tid=tid,
|
||||
trid=trid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -423,7 +423,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = []
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -477,7 +477,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
:return:
|
||||
"""
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -549,7 +549,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
try:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
status, res = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -557,7 +557,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
|
||||
# we need oid to to add object in tree at browser
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
tid=tid, data=data)
|
||||
status, trid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -609,7 +609,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# We will first fetch the trigger name for current request
|
||||
# so that we create template for dropping trigger
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -631,7 +631,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
data = dict(res['rows'][0])
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data,
|
||||
conn=self.conn,
|
||||
cascade=cascade
|
||||
@ -687,7 +687,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
# update the trigger then new OID is getting generated
|
||||
# so we need to return new OID of trigger.
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'get_oid.sql']),
|
||||
"/".join([self.template_path, self._OID_SQL]),
|
||||
tid=tid, data=data
|
||||
)
|
||||
status, new_trid = self.conn.execute_scalar(SQL)
|
||||
@ -695,7 +695,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
return internal_server_error(errormsg=new_trid)
|
||||
# Fetch updated properties
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=new_trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -859,7 +859,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
try:
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid, trid=trid,
|
||||
datlastsysoid=self.datlastsysoid)
|
||||
|
||||
@ -972,7 +972,7 @@ class TriggerView(PGChildNodeView, SchemaDiffObjectCompare):
|
||||
res = data
|
||||
else:
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, triggers = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
current_app.logger.error(triggers)
|
||||
|
@ -170,7 +170,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
data['seclabels'] = seclabels
|
||||
|
||||
# We need to parse & convert ACL coming from database to json format
|
||||
sql = render_template("/".join([self.table_template_path, 'acl.sql']),
|
||||
sql = render_template("/".join([self.table_template_path,
|
||||
self._ACL_SQL]),
|
||||
tid=tid, scid=scid)
|
||||
status, acl = self.conn.execute_dict(sql)
|
||||
if not status:
|
||||
@ -460,7 +461,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
data['schema'], data['name'])
|
||||
|
||||
sql_header += render_template("/".join([self.table_template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
|
||||
sql_header = sql_header.strip('\n')
|
||||
@ -476,11 +477,11 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
# if table is partitions then
|
||||
if 'relispartition' in data and data['relispartition']:
|
||||
table_sql = render_template("/".join([self.partition_template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
else:
|
||||
table_sql = render_template("/".join([self.table_template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, is_sql=True)
|
||||
|
||||
# Add into main sql
|
||||
@ -496,7 +497,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
"""
|
||||
|
||||
sql = render_template("/".join([self.index_template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -527,7 +528,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
sql = \
|
||||
render_template(
|
||||
"/".join([self.row_security_policies_template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -553,7 +554,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
########################################
|
||||
"""
|
||||
sql = render_template("/".join([self.trigger_template_path,
|
||||
'nodes.sql']), tid=tid)
|
||||
self._NODES_SQL]), tid=tid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
return internal_server_error(errormsg=rset)
|
||||
@ -580,7 +581,8 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
if self.manager.server_type == 'ppas' \
|
||||
and self.manager.version >= 120000:
|
||||
sql = render_template("/".join(
|
||||
[self.compound_trigger_template_path, 'nodes.sql']), tid=tid)
|
||||
[self.compound_trigger_template_path, self._NODES_SQL]),
|
||||
tid=tid)
|
||||
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -606,7 +608,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
"""
|
||||
|
||||
sql = render_template("/".join(
|
||||
[self.rules_template_path, 'nodes.sql']), tid=tid)
|
||||
[self.rules_template_path, self._NODES_SQL]), tid=tid)
|
||||
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -615,7 +617,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
for row in rset['rows']:
|
||||
rules_sql = '\n'
|
||||
sql = render_template("/".join(
|
||||
[self.rules_template_path, 'properties.sql']
|
||||
[self.rules_template_path, self._PROPERTIES_SQL]
|
||||
), rid=row['oid'], datlastsysoid=self.datlastsysoid)
|
||||
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -631,7 +633,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
res_data['view'] = table
|
||||
|
||||
rules_sql += render_template("/".join(
|
||||
[self.rules_template_path, 'create.sql']),
|
||||
[self.rules_template_path, self._CREATE_SQL]),
|
||||
data=res_data, display_comments=display_comments)
|
||||
|
||||
# Add into main sql
|
||||
@ -720,7 +722,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
copy.deepcopy(self.parse_vacuum_data(
|
||||
self.conn, row, 'toast'))
|
||||
partition_sql += render_template("/".join(
|
||||
[self.partition_template_path, 'create.sql']),
|
||||
[self.partition_template_path, self._CREATE_SQL]),
|
||||
data=part_data, conn=self.conn) + '\n'
|
||||
|
||||
# Add into main sql
|
||||
@ -776,7 +778,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
partition_main_sql = ""
|
||||
if is_partitioned:
|
||||
sql = render_template("/".join([self.partition_template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
scid=scid, tid=tid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -966,7 +968,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
# Sql for drop column
|
||||
if 'inheritedfrom' not in c:
|
||||
column_sql += render_template("/".join(
|
||||
[self.column_template_path, 'delete.sql']),
|
||||
[self.column_template_path, self._DELETE_SQL]),
|
||||
data=c, conn=self.conn).strip('\n') + '\n\n'
|
||||
return column_sql
|
||||
|
||||
@ -980,7 +982,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
|
||||
properties_sql = render_template(
|
||||
"/".join([self.column_template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
tid=tid,
|
||||
clid=c['attnum'],
|
||||
show_sys_objects=self.blueprint.show_system_objects
|
||||
@ -1008,7 +1010,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
if 'inheritedfrom' not in c and \
|
||||
'inheritedfromtable' not in c:
|
||||
column_sql += render_template("/".join(
|
||||
[self.column_template_path, 'update.sql']),
|
||||
[self.column_template_path, self._UPDATE_SQL]),
|
||||
data=c, o_data=old_col_data, conn=self.conn
|
||||
).strip('\n') + '\n\n'
|
||||
return column_sql
|
||||
@ -1025,7 +1027,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
if 'inheritedfrom' not in c and \
|
||||
'inheritedfromtable' not in c:
|
||||
column_sql += render_template("/".join(
|
||||
[self.column_template_path, 'create.sql']),
|
||||
[self.column_template_path, self._CREATE_SQL]),
|
||||
data=c, conn=self.conn).strip('\n') + '\n\n'
|
||||
return column_sql
|
||||
|
||||
@ -1179,7 +1181,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
self.update_vacuum_settings('vacuum_toast', old_data, data)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.table_template_path, 'update.sql']),
|
||||
"/".join([self.table_template_path, self._UPDATE_SQL]),
|
||||
o_data=old_data, data=data, conn=self.conn
|
||||
)
|
||||
# Removes training new lines
|
||||
@ -1248,7 +1250,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
self.update_vacuum_settings('vacuum_toast', data)
|
||||
|
||||
sql = render_template("/".join([self.table_template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
|
||||
# Append SQL for partitions
|
||||
@ -1392,7 +1394,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
tmp_data['name'] = row['partition_name']
|
||||
sql = render_template(
|
||||
"/".join([
|
||||
self.table_template_path, 'get_oid.sql'
|
||||
self.table_template_path, self._OID_SQL
|
||||
]),
|
||||
scid=scid, data=tmp_data
|
||||
)
|
||||
@ -1454,7 +1456,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
|
||||
partitions = []
|
||||
sql = render_template("/".join([self.partition_template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
scid=scid, tid=tid)
|
||||
status, rset = self.conn.execute_2darray(sql)
|
||||
if not status:
|
||||
@ -1628,7 +1630,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
part_data['name'] = row['temp_partition_name']
|
||||
|
||||
partition_sql = render_template(
|
||||
"/".join([self.partition_template_path, 'create.sql']),
|
||||
"/".join([self.partition_template_path, self._CREATE_SQL]),
|
||||
data=part_data, conn=self.conn
|
||||
)
|
||||
|
||||
@ -1681,7 +1683,7 @@ class BaseTableView(PGChildNodeView, BasePartitionTable):
|
||||
data = res['rows'][0]
|
||||
|
||||
return render_template(
|
||||
"/".join([self.table_template_path, 'delete.sql']),
|
||||
"/".join([self.table_template_path, self._DELETE_SQL]),
|
||||
data=data, cascade=cascade,
|
||||
conn=self.conn
|
||||
)
|
||||
|
@ -51,8 +51,8 @@ class TypeModule(SchemaChildModule):
|
||||
initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'type'
|
||||
COLLECTION_LABEL = gettext("Types")
|
||||
_NODE_TYPE = 'type'
|
||||
_COLLECTION_LABEL = gettext("Types")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -78,7 +78,7 @@ class TypeModule(SchemaChildModule):
|
||||
Load the module script for database, when any of the database node is
|
||||
initialized.
|
||||
"""
|
||||
return database.DatabaseModule.NODE_TYPE
|
||||
return database.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def node_inode(self):
|
||||
@ -275,7 +275,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"""
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
scid=scid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
show_system_objects=self.blueprint.show_system_objects)
|
||||
@ -309,7 +309,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
scid=scid,
|
||||
tid=tid,
|
||||
show_system_objects=self.blueprint.show_system_objects)
|
||||
@ -354,7 +354,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'nodes.sql']), scid=scid,
|
||||
self._NODES_SQL]), scid=scid,
|
||||
show_system_objects=self.blueprint.show_system_objects)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
@ -582,7 +582,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
@ -599,7 +599,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
copy_dict = dict(res['rows'][0])
|
||||
|
||||
# We need to parse & convert ACL coming from database to json format
|
||||
SQL = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
scid=scid, tid=tid)
|
||||
status, acl = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -986,7 +986,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
each_type['type'])
|
||||
each_type['hasSqrBracket'] = self.hasSqrBracket
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'create.sql']),
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -1003,7 +1004,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
# we need oid to to add object in tree at browser
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'get_oid.sql']),
|
||||
self._OID_SQL]),
|
||||
scid=scid, data=data)
|
||||
status, tid = self.conn.execute_scalar(SQL)
|
||||
if not status:
|
||||
@ -1096,7 +1097,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
for tid in data['ids']:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
@ -1120,7 +1121,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
data = dict(res['rows'][0])
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data,
|
||||
cascade=cascade,
|
||||
conn=self.conn)
|
||||
@ -1243,7 +1244,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
@ -1259,7 +1260,8 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
# Making copy of output for future use
|
||||
old_data = dict(res['rows'][0])
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
self._ACL_SQL]),
|
||||
scid=scid, tid=tid)
|
||||
status, acl = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -1290,7 +1292,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
)
|
||||
else:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data, conn=self.conn
|
||||
)
|
||||
else:
|
||||
@ -1333,7 +1335,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
each_type['hasSqrBracket'] = self.hasSqrBracket
|
||||
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'create.sql']),
|
||||
self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, is_sql=is_sql)
|
||||
|
||||
return SQL, data['name'] if 'name' in data else old_data['name']
|
||||
@ -1357,7 +1359,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path,
|
||||
'properties.sql']),
|
||||
self._PROPERTIES_SQL]),
|
||||
scid=scid, tid=tid,
|
||||
datlastsysoid=self.datlastsysoid,
|
||||
show_system_objects=self.blueprint.show_system_objects
|
||||
@ -1375,7 +1377,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
if diff_schema:
|
||||
data['schema'] = diff_schema
|
||||
|
||||
SQL = render_template("/".join([self.template_path, 'acl.sql']),
|
||||
SQL = render_template("/".join([self.template_path, self._ACL_SQL]),
|
||||
scid=scid, tid=tid)
|
||||
status, acl = self.conn.execute_dict(SQL)
|
||||
if not status:
|
||||
@ -1413,7 +1415,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
sql_header = u"-- Type: {0}\n\n-- ".format(data['name'])
|
||||
|
||||
sql_header += render_template("/".join([self.template_path,
|
||||
'delete.sql']),
|
||||
self._DELETE_SQL]),
|
||||
data=data, conn=self.conn)
|
||||
SQL = sql_header + '\n\n' + SQL
|
||||
|
||||
@ -1479,7 +1481,7 @@ class TypeView(PGChildNodeView, DataTypeReader, SchemaDiffObjectCompare):
|
||||
"""
|
||||
res = dict()
|
||||
SQL = render_template("/".join([self.template_path,
|
||||
'nodes.sql']),
|
||||
self._NODES_SQL]),
|
||||
scid=scid, datlastsysoid=self.datlastsysoid)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
if not status:
|
||||
|
@ -72,8 +72,8 @@ class ViewModule(SchemaChildModule):
|
||||
- Load the module script for View, when any of the server node is
|
||||
initialized.
|
||||
"""
|
||||
NODE_TYPE = 'view'
|
||||
COLLECTION_LABEL = gettext("Views")
|
||||
_NODE_TYPE = 'view'
|
||||
_COLLECTION_LABEL = gettext("Views")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -100,7 +100,7 @@ class ViewModule(SchemaChildModule):
|
||||
initialized, The reason is views are also listed under catalogs
|
||||
which are loaded under database node.
|
||||
"""
|
||||
return databases.DatabaseModule.NODE_TYPE
|
||||
return databases.DatabaseModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -184,8 +184,8 @@ class MViewModule(ViewModule):
|
||||
A module class for the materialized view node derived from ViewModule.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'mview'
|
||||
COLLECTION_LABEL = gettext("Materialized Views")
|
||||
_NODE_TYPE = 'mview'
|
||||
_COLLECTION_LABEL = gettext("Materialized Views")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
@ -1397,7 +1397,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([
|
||||
self.column_template_path, 'properties.sql'
|
||||
self.column_template_path, self._PROPERTIES_SQL
|
||||
]),
|
||||
scid=scid, tid=vid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
@ -1459,7 +1459,7 @@ class ViewNode(PGChildNodeView, VacuumSettings, SchemaDiffObjectCompare):
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([
|
||||
self.column_template_path, 'properties.sql'
|
||||
self.column_template_path, self._PROPERTIES_SQL
|
||||
]),
|
||||
scid=scid, tid=vid,
|
||||
datlastsysoid=self.datlastsysoid
|
||||
|
@ -29,8 +29,8 @@ from pgadmin.browser.server_groups.servers.pgagent.utils \
|
||||
|
||||
|
||||
class JobModule(CollectionNodeModule):
|
||||
NODE_TYPE = 'pga_job'
|
||||
COLLECTION_LABEL = _("pgAgent Jobs")
|
||||
_NODE_TYPE = 'pga_job'
|
||||
_COLLECTION_LABEL = _("pgAgent Jobs")
|
||||
|
||||
def get_nodes(self, gid, sid):
|
||||
"""
|
||||
@ -45,7 +45,7 @@ class JobModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return servers.ServerModule.NODE_TYPE
|
||||
return servers.ServerModule.node_type
|
||||
|
||||
def backend_supported(self, manager, **kwargs):
|
||||
if hasattr(self, 'show_node') and not self.show_node:
|
||||
@ -180,7 +180,7 @@ SELECT EXISTS(
|
||||
@check_precondition
|
||||
def nodes(self, gid, sid, jid=None):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jid=jid, conn=self.conn
|
||||
)
|
||||
status, rset = self.conn.execute_dict(SQL)
|
||||
@ -224,7 +224,7 @@ SELECT EXISTS(
|
||||
@check_precondition
|
||||
def properties(self, gid, sid, jid=None):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jid=jid, conn=self.conn
|
||||
)
|
||||
status, rset = self.conn.execute_dict(SQL)
|
||||
@ -294,7 +294,7 @@ SELECT EXISTS(
|
||||
|
||||
status, res = self.conn.execute_scalar(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn, fetch_id=True,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
)
|
||||
@ -307,7 +307,7 @@ SELECT EXISTS(
|
||||
# We need oid of newly created database
|
||||
status, res = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jid=res, conn=self.conn
|
||||
)
|
||||
)
|
||||
@ -341,7 +341,7 @@ SELECT EXISTS(
|
||||
|
||||
status, res = self.conn.execute_void(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, conn=self.conn, jid=jid,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
)
|
||||
@ -353,7 +353,7 @@ SELECT EXISTS(
|
||||
# We need oid of newly created database
|
||||
status, res = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jid=jid, conn=self.conn
|
||||
)
|
||||
)
|
||||
@ -387,7 +387,7 @@ SELECT EXISTS(
|
||||
for jid in data['ids']:
|
||||
status, res = self.conn.execute_void(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
jid=jid, conn=self.conn
|
||||
)
|
||||
)
|
||||
@ -417,7 +417,7 @@ SELECT EXISTS(
|
||||
data=render_template(
|
||||
"/".join([
|
||||
self.template_path,
|
||||
'create.sql' if jid is None else 'update.sql'
|
||||
self._CREATE_SQL if jid is None else self._UPDATE_SQL
|
||||
]),
|
||||
jid=jid, data=data, conn=self.conn, fetch_id=False,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
@ -460,7 +460,7 @@ SELECT EXISTS(
|
||||
This function will generate sql for sql panel
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jid=jid, conn=self.conn, last_system_oid=0
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -517,7 +517,7 @@ SELECT EXISTS(
|
||||
|
||||
return ajax_response(
|
||||
response=render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
jid=jid, data=row, conn=self.conn, fetch_id=False,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
)
|
||||
|
@ -40,8 +40,8 @@ class JobScheduleModule(CollectionNodeModule):
|
||||
- Method is overridden from its base class to make the node as leaf node.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'pga_schedule'
|
||||
COLLECTION_LABEL = gettext("Schedules")
|
||||
_NODE_TYPE = 'pga_schedule'
|
||||
_COLLECTION_LABEL = gettext("Schedules")
|
||||
|
||||
def get_nodes(self, gid, sid, jid):
|
||||
"""
|
||||
@ -214,7 +214,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
jid: Job ID
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jid=jid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -240,7 +240,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
"""
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jscid=jscid,
|
||||
jid=jid
|
||||
)
|
||||
@ -297,7 +297,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
jscid: JobSchedule ID
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jscid=jscid, jid=jid
|
||||
)
|
||||
status, res = self.conn.execute_dict(sql)
|
||||
@ -340,7 +340,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
format_schedule_data(data)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
jid=jid,
|
||||
data=data,
|
||||
fetch_id=True
|
||||
@ -358,7 +358,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
|
||||
self.conn.execute_void('END')
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jscid=res,
|
||||
jid=jid
|
||||
)
|
||||
@ -410,7 +410,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
format_schedule_data(data)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
jid=jid,
|
||||
jscid=jscid,
|
||||
data=data
|
||||
@ -422,7 +422,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jscid=jscid,
|
||||
jid=jid
|
||||
)
|
||||
@ -462,7 +462,7 @@ class JobScheduleView(PGChildNodeView):
|
||||
for jscid in data['ids']:
|
||||
status, res = self.conn.execute_void(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
jid=jid, jscid=jscid, conn=self.conn
|
||||
)
|
||||
)
|
||||
@ -495,14 +495,14 @@ class JobScheduleView(PGChildNodeView):
|
||||
|
||||
if jscid is None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
jid=jid,
|
||||
data=data,
|
||||
fetch_id=False
|
||||
)
|
||||
else:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
jid=jid,
|
||||
jscid=jscid,
|
||||
data=data
|
||||
|
@ -39,8 +39,8 @@ class JobStepModule(CollectionNodeModule):
|
||||
- Method is overridden from its base class to make the node as leaf node.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'pga_jobstep'
|
||||
COLLECTION_LABEL = gettext("Steps")
|
||||
_NODE_TYPE = 'pga_jobstep'
|
||||
_COLLECTION_LABEL = gettext("Steps")
|
||||
|
||||
def get_nodes(self, gid, sid, jid):
|
||||
"""
|
||||
@ -226,7 +226,7 @@ SELECT EXISTS(
|
||||
jid: Job ID
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jid=jid,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
)
|
||||
@ -254,7 +254,7 @@ SELECT EXISTS(
|
||||
"""
|
||||
res = []
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jstid=jstid,
|
||||
jid=jid
|
||||
)
|
||||
@ -311,7 +311,7 @@ SELECT EXISTS(
|
||||
jstid: JobStep ID
|
||||
"""
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jstid=jstid,
|
||||
jid=jid,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
@ -352,7 +352,7 @@ SELECT EXISTS(
|
||||
data = json.loads(request.data.decode())
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
jid=jid,
|
||||
data=data,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
@ -364,7 +364,7 @@ SELECT EXISTS(
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jstid=res,
|
||||
jid=jid
|
||||
)
|
||||
@ -411,7 +411,7 @@ SELECT EXISTS(
|
||||
('jstdbname' in data or 'jstconnstr' in data)
|
||||
):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jstid=jstid,
|
||||
jid=jid,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
@ -438,7 +438,7 @@ SELECT EXISTS(
|
||||
data['jstconnstr'] = row['jstconnstr']
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
jid=jid,
|
||||
jstid=jstid,
|
||||
data=data,
|
||||
@ -451,7 +451,7 @@ SELECT EXISTS(
|
||||
return internal_server_error(errormsg=res)
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
jstid=jstid,
|
||||
jid=jid
|
||||
)
|
||||
@ -491,7 +491,7 @@ SELECT EXISTS(
|
||||
for jstid in data['ids']:
|
||||
status, res = self.conn.execute_void(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
jid=jid, jstid=jstid, conn=self.conn
|
||||
)
|
||||
)
|
||||
@ -524,7 +524,7 @@ SELECT EXISTS(
|
||||
|
||||
if jstid is None:
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
jid=jid,
|
||||
data=data,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
@ -536,7 +536,7 @@ SELECT EXISTS(
|
||||
('jstdbname' in data or 'jstconnstr' in data)
|
||||
):
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
jstid=jstid,
|
||||
jid=jid,
|
||||
has_connstr=self.manager.db_info['pgAgent']['has_connstr']
|
||||
@ -563,7 +563,7 @@ SELECT EXISTS(
|
||||
data['jstconnstr'] = row['jstconnstr']
|
||||
|
||||
sql = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
jid=jid,
|
||||
jstid=jstid,
|
||||
data=data,
|
||||
|
@ -52,8 +52,8 @@ class ResourceGroupModule(CollectionNodeModule):
|
||||
node is initialized.
|
||||
"""
|
||||
|
||||
NODE_TYPE = 'resource_group'
|
||||
COLLECTION_LABEL = gettext("Resource Groups")
|
||||
_NODE_TYPE = 'resource_group'
|
||||
_COLLECTION_LABEL = gettext("Resource Groups")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
"""
|
||||
|
@ -25,8 +25,8 @@ from config import PG_DEFAULT_DRIVER
|
||||
|
||||
|
||||
class RoleModule(CollectionNodeModule):
|
||||
NODE_TYPE = 'role'
|
||||
COLLECTION_LABEL = _("Login/Group Roles")
|
||||
_NODE_TYPE = 'role'
|
||||
_COLLECTION_LABEL = _("Login/Group Roles")
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
self.min_ver = None
|
||||
@ -54,7 +54,7 @@ class RoleModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return sg.ServerGroupModule.NODE_TYPE
|
||||
return sg.ServerGroupModule.node_type
|
||||
|
||||
@property
|
||||
def csssnippets(self):
|
||||
@ -565,7 +565,7 @@ rolmembership:{
|
||||
def list(self, gid, sid):
|
||||
status, res = self.conn.execute_dict(
|
||||
render_template(
|
||||
self.sql_path + 'properties.sql'
|
||||
self.sql_path + self._PROPERTIES_SQL
|
||||
)
|
||||
)
|
||||
|
||||
@ -587,7 +587,7 @@ rolmembership:{
|
||||
def nodes(self, gid, sid):
|
||||
|
||||
status, rset = self.conn.execute_2darray(
|
||||
render_template(self.sql_path + 'nodes.sql')
|
||||
render_template(self.sql_path + self._NODES_SQL)
|
||||
)
|
||||
|
||||
if not status:
|
||||
@ -620,7 +620,7 @@ rolmembership:{
|
||||
|
||||
status, rset = self.conn.execute_2darray(
|
||||
render_template(
|
||||
self.sql_path + 'nodes.sql',
|
||||
self.sql_path + self._NODES_SQL,
|
||||
rid=rid
|
||||
)
|
||||
)
|
||||
@ -674,7 +674,7 @@ rolmembership:{
|
||||
|
||||
status, res = self.conn.execute_dict(
|
||||
render_template(
|
||||
self.sql_path + 'properties.sql',
|
||||
self.sql_path + self._PROPERTIES_SQL,
|
||||
rid=rid
|
||||
)
|
||||
)
|
||||
@ -773,7 +773,7 @@ rolmembership:{
|
||||
def create(self, gid, sid):
|
||||
|
||||
sql = render_template(
|
||||
self.sql_path + 'create.sql',
|
||||
self.sql_path + self._CREATE_SQL,
|
||||
data=self.request,
|
||||
dummy=False,
|
||||
conn=self.conn
|
||||
@ -797,7 +797,7 @@ rolmembership:{
|
||||
)
|
||||
|
||||
status, rset = self.conn.execute_dict(
|
||||
render_template(self.sql_path + 'nodes.sql',
|
||||
render_template(self.sql_path + self._NODES_SQL,
|
||||
rid=rid
|
||||
)
|
||||
)
|
||||
@ -826,7 +826,7 @@ rolmembership:{
|
||||
def update(self, gid, sid, rid):
|
||||
|
||||
sql = render_template(
|
||||
self.sql_path + 'update.sql',
|
||||
self.sql_path + self._UPDATE_SQL,
|
||||
data=self.request,
|
||||
dummy=False,
|
||||
conn=self.conn,
|
||||
@ -845,7 +845,7 @@ rolmembership:{
|
||||
)
|
||||
|
||||
status, rset = self.conn.execute_dict(
|
||||
render_template(self.sql_path + 'nodes.sql',
|
||||
render_template(self.sql_path + self._NODES_SQL,
|
||||
rid=rid
|
||||
)
|
||||
)
|
||||
@ -877,7 +877,7 @@ rolmembership:{
|
||||
if rid is None:
|
||||
return make_json_response(
|
||||
data=render_template(
|
||||
self.sql_path + 'create.sql',
|
||||
self.sql_path + self._CREATE_SQL,
|
||||
data=self.request,
|
||||
dummy=True,
|
||||
conn=self.conn
|
||||
@ -886,7 +886,7 @@ rolmembership:{
|
||||
else:
|
||||
return make_json_response(
|
||||
data=render_template(
|
||||
self.sql_path + 'update.sql',
|
||||
self.sql_path + self._UPDATE_SQL,
|
||||
data=self.request,
|
||||
dummy=True,
|
||||
conn=self.conn,
|
||||
|
@ -25,8 +25,8 @@ from config import PG_DEFAULT_DRIVER
|
||||
|
||||
|
||||
class TablespaceModule(CollectionNodeModule):
|
||||
NODE_TYPE = 'tablespace'
|
||||
COLLECTION_LABEL = gettext("Tablespaces")
|
||||
_NODE_TYPE = 'tablespace'
|
||||
_COLLECTION_LABEL = gettext("Tablespaces")
|
||||
|
||||
def __init__(self, import_name, **kwargs):
|
||||
super(TablespaceModule, self).__init__(import_name, **kwargs)
|
||||
@ -44,7 +44,7 @@ class TablespaceModule(CollectionNodeModule):
|
||||
Load the module script for server, when any of the server-group node is
|
||||
initialized.
|
||||
"""
|
||||
return servers.ServerModule.NODE_TYPE
|
||||
return servers.ServerModule.node_type
|
||||
|
||||
@property
|
||||
def module_use_template_javascript(self):
|
||||
@ -139,7 +139,7 @@ class TablespaceView(PGChildNodeView):
|
||||
@check_precondition
|
||||
def list(self, gid, sid):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -154,7 +154,7 @@ class TablespaceView(PGChildNodeView):
|
||||
@check_precondition
|
||||
def node(self, gid, sid, tsid):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -180,7 +180,7 @@ class TablespaceView(PGChildNodeView):
|
||||
def nodes(self, gid, sid, tsid=None):
|
||||
res = []
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, rset = self.conn.execute_2darray(SQL)
|
||||
@ -230,7 +230,7 @@ class TablespaceView(PGChildNodeView):
|
||||
|
||||
# We need to parse & convert ACL coming from database to json format
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'acl.sql']),
|
||||
"/".join([self.template_path, self._ACL_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, acl = self.conn.execute_dict(SQL)
|
||||
@ -253,7 +253,7 @@ class TablespaceView(PGChildNodeView):
|
||||
@check_precondition
|
||||
def properties(self, gid, sid, tsid):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -307,7 +307,7 @@ class TablespaceView(PGChildNodeView):
|
||||
|
||||
try:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data, conn=self.conn
|
||||
)
|
||||
|
||||
@ -398,7 +398,7 @@ class TablespaceView(PGChildNodeView):
|
||||
# Get name for tablespace from tsid
|
||||
status, rset = self.conn.execute_dict(
|
||||
render_template(
|
||||
"/".join([self.template_path, 'nodes.sql']),
|
||||
"/".join([self.template_path, self._NODES_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
)
|
||||
@ -419,7 +419,7 @@ class TablespaceView(PGChildNodeView):
|
||||
|
||||
# drop tablespace
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'delete.sql']),
|
||||
"/".join([self.template_path, self._DELETE_SQL]),
|
||||
tsname=(rset['rows'][0])['name'], conn=self.conn
|
||||
)
|
||||
|
||||
@ -477,7 +477,7 @@ class TablespaceView(PGChildNodeView):
|
||||
|
||||
if tsid is not None:
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -516,7 +516,7 @@ class TablespaceView(PGChildNodeView):
|
||||
data[arg] = old_data[arg]
|
||||
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'update.sql']),
|
||||
"/".join([self.template_path, self._UPDATE_SQL]),
|
||||
data=data, o_data=old_data
|
||||
)
|
||||
else:
|
||||
@ -525,7 +525,7 @@ class TablespaceView(PGChildNodeView):
|
||||
data['spcacl'] = parse_priv_to_db(data['spcacl'], self.acl)
|
||||
# If the request for new object which do not have tsid
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=data
|
||||
)
|
||||
SQL += "\n"
|
||||
@ -542,7 +542,7 @@ class TablespaceView(PGChildNodeView):
|
||||
This function will generate sql for sql panel
|
||||
"""
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'properties.sql']),
|
||||
"/".join([self.template_path, self._PROPERTIES_SQL]),
|
||||
tsid=tsid, conn=self.conn
|
||||
)
|
||||
status, res = self.conn.execute_dict(SQL)
|
||||
@ -566,7 +566,7 @@ class TablespaceView(PGChildNodeView):
|
||||
# We are not showing create sql for system tablespace
|
||||
if not old_data['name'].startswith('pg_'):
|
||||
SQL = render_template(
|
||||
"/".join([self.template_path, 'create.sql']),
|
||||
"/".join([self.template_path, self._CREATE_SQL]),
|
||||
data=old_data
|
||||
)
|
||||
SQL += "\n"
|
||||
|
@ -371,6 +371,17 @@ class NodeView(with_metaclass(MethodViewType, View)):
|
||||
|
||||
class PGChildNodeView(NodeView):
|
||||
|
||||
_NODE_SQL = 'node.sql'
|
||||
_NODES_SQL = 'nodes.sql'
|
||||
_CREATE_SQL = 'create.sql'
|
||||
_UPDATE_SQL = 'update.sql'
|
||||
_PROPERTIES_SQL = 'properties.sql'
|
||||
_DELETE_SQL = 'delete.sql'
|
||||
_GRANT_SQL = 'grant.sql'
|
||||
_SCHEMA_SQL = 'schema.sql'
|
||||
_ACL_SQL = 'acl.sql'
|
||||
_OID_SQL = 'get_oid.sql'
|
||||
|
||||
def get_children_nodes(self, manager, **kwargs):
|
||||
"""
|
||||
Returns the list of children nodes for the current nodes.
|
||||
|
@ -471,7 +471,7 @@ def compare(trans_id, source_sid, source_did, source_scid,
|
||||
view = SchemaDiffRegistry.get_node_view(node_name)
|
||||
if hasattr(view, 'compare'):
|
||||
msg = gettext('Comparing {0}').\
|
||||
format(gettext(view.blueprint.COLLECTION_LABEL))
|
||||
format(gettext(view.blueprint.collection_label))
|
||||
diff_model_obj.set_comparison_info(msg, total_percent)
|
||||
# Update the message and total percentage in session object
|
||||
update_session_diff_transaction(trans_id, session_obj,
|
||||
|
@ -92,7 +92,7 @@ class SchemaDiffObjectCompare:
|
||||
source_dict=source,
|
||||
target_dict=target,
|
||||
node=self.node_type,
|
||||
node_label=self.blueprint.COLLECTION_LABEL,
|
||||
node_label=self.blueprint.collection_label,
|
||||
ignore_whitespaces=ignore_whitespaces,
|
||||
ignore_keys=self.keys_to_ignore)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user