MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / has_nodes

Method has_nodes

web/pgadmin/browser/collection.py:100–134  ·  view source on GitHub ↗
(self, sid, did, scid=None, tid=None, vid=None,
                  base_template_path='')

Source from the content-addressed store, hash-verified

98 return obj
99
100 def has_nodes(self, sid, did, scid=None, tid=None, vid=None,
101 base_template_path=''):
102 if self.pref_show_empty_coll_nodes.get():
103 return True
104
105 try:
106 driver = get_driver(PG_DEFAULT_DRIVER)
107 manager = driver.connection_manager(sid)
108 conn = manager.connection(did=did)
109 if '{1}' in base_template_path:
110 template_base_path = base_template_path.format(
111 manager.server_type, manager.version)
112 else:
113 template_base_path = base_template_path.format(manager.version)
114
115 last_system_oid = 0 if self.show_system_objects else \
116 PGChildNodeView._DATABASE_LAST_SYSTEM_OID
117
118 sql = render_template(
119 "/".join([template_base_path, PGChildNodeView._COUNT_SQL]),
120 did=did,
121 scid=scid,
122 tid=tid,
123 vid=vid,
124 datlastsysoid=last_system_oid,
125 showsysobj=self.show_system_objects,
126 conn=conn
127 )
128
129 status, res = conn.execute_dict(sql)
130
131 return int(res['rows'][0]['count']) > 0 if status \
132 else True
133 except Exception as _:
134 return True
135
136 @property
137 def node_type(self):

Callers 15

get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80
get_nodesMethod · 0.80

Calls 6

get_driverFunction · 0.90
connection_managerMethod · 0.80
connectionMethod · 0.80
joinMethod · 0.80
getMethod · 0.45
execute_dictMethod · 0.45

Tested by

no test coverage detected