Database
========

We support Oracle and Postgres databases.

Multiple hosts
--------------

The `dsn` parameter of service database config should be specified to enable multihost option for Postgres.

DSN may be specified in the following format: `luna:luna@postgres01:5432,postgres02:5432/luna_streams?some_option=some_value`.
It is possible to partially fill in the DSN string (e.g. `postgres01,postgres02/luna_streams`), and then the missing parameters will be filled in from proprietary parameter values (or defaults).

At startup, the service will create a pool of connections to one of DSN hosts available.
In case of problems with establishing a connection after several unsuccessful attempts, the service will again try to set up a connection pool to any of DSN hosts available.

DB scheme
---------
.. image:: db.png

.. automodule:: luna_streams.db.streams_db_tools.models.streams_db_models
	:members:
