gws.plugin.postgres.provider

PostgreSQL database provider.

Source code: gws.plugin.postgres.provider

Module Contents

class gws.plugin.postgres.provider.Config

Bases: gws.base.database.provider.Config

Connection to a PostgreSQL/PostGIS database.

database: str | None

Database name.

host: str | None

Database host.

options: dict | None

Extra libpq connection parameters.

password: str | None

Password.

port: int = 5432

Database port.

serviceName: str | None

Service name from the PostgreSQL service file.

username: str | None

User name.

gws.plugin.postgres.provider.connection_url(cfg: gws.Config) → str | None

Create a connection URL from a provider configuration.

If host is configured, the URL is built from the host, port, database and credentials. Otherwise, if serviceName is configured, the URL refers to that service in the PostgreSQL service file given by PGSERVICEFILE. options are added as URL parameters, with application_name set to GWS by default.

Parameters:

cfg – Provider configuration.

Returns:

The connection URL, or None if neither host nor serviceName is configured.

Raises:

sa.Error – If serviceName is used and the service file does not exist.

class gws.plugin.postgres.provider.Object

Bases: gws.base.database.provider.Object

PostgreSQL/PostGIS database provider.

Connects to a PostgreSQL database and describes its tables and columns, including PostGIS geometry columns, for the layers, models and finders that use it.

describe_column(table, column_name)
join_table_name(schema, name)
split_table_name(table_name)
table_bounds(table)
url()