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

Function _get_database_role

web/pgadmin/tools/psql/__init__.py:617–636  ·  view source on GitHub ↗

This method is used to get database based on sid, did.

(sid, did)

Source from the content-addressed store, hash-verified

615
616
617def _get_database_role(sid, did):
618 """
619 This method is used to get database based on sid, did.
620 """
621 try:
622 from pgadmin.utils.driver import get_driver
623 manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(int(sid))
624 conn = manager.connection(did=int(did))
625
626 is_connected = get_connection_status(conn)
627
628 if not is_connected:
629 conn.connect()
630
631 db_name = conn.db
632 role = manager.role if manager.role else None
633 return {'db_name': db_name, 'role': role}
634 except Exception as e:
635 print(str(e))
636 return None
637
638
639def get_open_psql_connections():

Callers 1

panelFunction · 0.85

Calls 5

get_driverFunction · 0.90
get_connection_statusFunction · 0.85
connection_managerMethod · 0.80
connectionMethod · 0.80
connectMethod · 0.45

Tested by

no test coverage detected