MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / get_data

Function get_data

web/pgadmin/tools/grant_wizard/__init__.py:270–389  ·  view source on GitHub ↗
(sid, did, node_id, node_type, server_data,
             return_emtpy_schema=False)

Source from the content-addressed store, hash-verified

268
269
270def get_data(sid, did, node_id, node_type, server_data,
271 return_emtpy_schema=False):
272 get_schema_sql_url = '/sql/get_schemas.sql'
273
274 # unquote encoded url parameter
275 node_type = unquote(node_type)
276
277 server_prop = server_data
278
279 res_data = []
280 failed_objects = []
281 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(sid)
282 conn = manager.connection(did=did)
283
284 show_sysobj = blueprint.show_system_objects().get()
285
286 sql, ntype = get_node_sql_with_type(node_id, node_type, server_prop,
287 get_schema_sql_url, show_sysobj)
288
289 status, res = conn.execute_dict(sql)
290
291 if not status:
292 return None, internal_server_error(errormsg=res)
293 node_types = res['rows']
294
295 def _append_rows(status, res, disp_type):
296 if not status:
297 current_app.logger.error(res)
298 failed_objects.append(disp_type)
299 else:
300 if len(res) > 0:
301 res_data.extend(res['rows'])
302
303 empty_schema_list = []
304 for row in node_types:
305 is_empty_schema = True
306 if 'oid' in row:
307 node_id = row['oid']
308
309 if ntype == 'schema':
310 status, res = _get_rows_for_type(
311 conn, 'function', server_prop, node_id)
312
313 _append_rows(status, res, 'function')
314
315 status, res = _get_rows_for_type(
316 conn, 'procedure', server_prop, node_id)
317
318 _append_rows(status, res, 'procedure')
319
320 status, res = _get_rows_for_type(
321 conn, 'trigger_function', server_prop, node_id)
322
323 _append_rows(status, res, 'trigger function')
324
325 status, res = _get_rows_for_type(
326 conn, 'sequence', server_prop, node_id)
327

Callers 2

objectsFunction · 0.90
propertiesFunction · 0.70

Calls 13

get_driverFunction · 0.90
internal_server_errorFunction · 0.90
get_node_sql_with_typeFunction · 0.85
_get_rows_for_typeFunction · 0.85
_append_rowsFunction · 0.85
gettextFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80
appendMethod · 0.80
joinMethod · 0.80
getMethod · 0.45
show_system_objectsMethod · 0.45

Tested by

no test coverage detected