Top level package

Python PGX client.

Some core functions are provided directly at the top level of the package.

The documented behaviour of the PyPGX API is stable between versions. Other parts of the API, in particular attributes whose name starts with an underscore, are considered internal implementation details and may change between versions.

exception pypgx.PgxError

Bases: Exception

An error representing exceptions from PGX.

pypgx.get_instance(base_url=None, token=None)

Get a handle to a PGX instance.

Parameters
  • base_url (Optional[str]) – The base URL in the format host [ : port][ /path] of the PGX server REST end-point. If base_url is None, the default will be used which points to embedded PGX instance.

  • token (Optional[str]) – The access token

Return type

pypgx.api._server_instance.ServerInstance

pypgx.get_session(base_url=None, session_name=None, token=None, idle_timeout=None, task_timeout=None, pgx_conf=None, redirect_stdout=None, redirect_stderr=None)

Connect to a PGX server and return a PgxSession instance.

Parameters
  • base_url (Optional[str]) – The URL of the running session. If None a session is created.

  • session_name (Optional[str]) – Session name. If None “python_pgx_client” is the default value.

  • token (Optional[str]) – The access token

  • idle_timeout (Optional[int]) – Number of seconds after which the shell session will time out.

  • task_timeout (Optional[int]) – Number of seconds after which tasks submitted by the shell session will time out.

  • pgx_conf (Optional[str]) – Path to PGX config file. If not set, PGX looks at default locations. See the ‘Engine and Runtime Configuration Guide’ in the PGX documentation.

  • redirect_stdout (None) – Deprecated.

  • redirect_stderr (None) – Deprecated.

Returns

PgxSession

Return type

pypgx.api._pgx_session.PgxSession

pypgx.setloglevel(loggername='', loglevel='DEBUG')

Set loglevel for PGX.

If loglevel is invalid (see below), it writes this to the python log as an error without raising any exceptions.

Parameters
  • loggername (str) – Name of the PGX logger. If empty, ROOT logger’s level is updated.

  • loglevel (str) – Level specification. Must be one of “OFF”, “FATAL”, “ERROR”, “WARN”, “INFO”, “DEBUG”, “TRACE”, “ALL”

Returns

None

Return type

None