dicogis.models.database_connection module¶
Model for database connection.
- class dicogis.models.database_connection.DatabaseConnection(name=None, database_name=None, host=None, port=None, service_name=None, user_name=None, user_password=None, is_esri_sde=False, is_postgis=True, sgbd_schemas=None, sgbd_version=None, state_msg=None)¶
Bases:
object
Database connection abstraction model.
- __init__(name=None, database_name=None, host=None, port=None, service_name=None, user_name=None, user_password=None, is_esri_sde=False, is_postgis=True, sgbd_schemas=None, sgbd_version=None, state_msg=None)¶
- property connection_params_as_dict: dict | None¶
- Return connection parameters as dictionary. Useful to create a service in a
pg_service.conf file.
- Returns:
connection parameters as dict
- property pg_connection_string: str¶
Get PostgreSQL connection string.
See: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING. Structure: host=localhost port=5432 dbname=mydb connect_timeout=10
- Returns:
Connection string for PostgreSQL
- Return type:
- property pg_connection_uri: str¶
Get PostgreSQL connection URI.
See: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING. Structure: postgresql://[userspec@][hostspec][/dbname][?paramspec]
- Returns:
Connection URI for PostgreSQL
- Return type:
- store_in_pgservice_file()¶
- Store database connection to service file (typically on Linux
~/.pg_service.conf).