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

Function objects

web/pgadmin/tools/backup/__init__.py:557–675  ·  view source on GitHub ↗

This function returns backup objects Args: sid: Server ID did: database ID scid: schema ID Returns: list of objects

(sid, did, scid=None)

Source from the content-addressed store, hash-verified

555)
556@pga_login_required
557def objects(sid, did, scid=None):
558 """
559 This function returns backup objects
560
561 Args:
562 sid: Server ID
563 did: database ID
564 scid: schema ID
565 Returns:
566 list of objects
567 """
568 server = get_server(sid)
569
570 if server is None:
571 return make_json_response(
572 success=0,
573 errormsg=SERVER_NOT_FOUND
574 )
575
576 from pgadmin.utils.driver import get_driver
577 from pgadmin.utils.ajax import precondition_required
578
579 server_info = {}
580 server_info['manager'] = get_driver(PG_DEFAULT_DRIVER) \
581 .connection_manager(sid)
582 server_info['conn'] = server_info['manager'].connection(
583 did=did)
584 # If DB not connected then return error to browser
585 if not server_info['conn'].connected():
586 return precondition_required(
587 gettext("Connection to the server has been lost.")
588 )
589
590 # Set template path for sql scripts
591 server_info['server_type'] = server_info['manager'].server_type
592 server_info['version'] = server_info['manager'].version
593 if server_info['server_type'] == 'pg':
594 server_info['template_path'] = 'grant_wizard/pg/#{0}#'.format(
595 server_info['version'])
596 elif server_info['server_type'] == 'ppas':
597 server_info['template_path'] = 'grant_wizard/ppas/#{0}#'.format(
598 server_info['version'])
599
600 res, _, empty_schema_list = get_data(sid, did, scid,
601 'schema' if scid else 'database',
602 server_info, True)
603
604 tree_data = {
605 'table': [],
606 'view': [],
607 MVIEW_STR: [],
608 FOREIGN_TABLE_STR: [],
609 'sequence': []
610 }
611
612 schema_group = {}
613
614 for data in res:

Callers

nothing calls this directly

Calls 10

get_serverFunction · 0.90
make_json_responseFunction · 0.90
get_driverFunction · 0.90
precondition_requiredFunction · 0.90
get_dataFunction · 0.90
gettextFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80
appendMethod · 0.80
connectedMethod · 0.45

Tested by

no test coverage detected