arrakis.utils.database

Database utilities

Module Contents

Functions

get_beam_inf_db(→ pymongo.collection.Collection)

Get MongoDBs

get_db(→ Tuple[pymongo.collection.Collection, ...)

Get MongoDBs

get_field_db(→ pymongo.collection.Collection)

Get MongoDBs

test_db(→ bool)

Test connection to MongoDB

arrakis.utils.database.get_beam_inf_db(host: str, epoch: int, username=None, password=None) pymongo.collection.Collection[source]

Get MongoDBs

Parameters:
  • host (str) – Mongo host IP.

  • username (str, optional) – Username. Defaults to None.

  • password (str, optional) – Password. Defaults to None.

Returns:

beams_col, island_col, comp_col

Return type:

pymongo.Collection

arrakis.utils.database.get_db(host: str, epoch: int, username: str | None = None, password: str | None = None) Tuple[pymongo.collection.Collection, pymongo.collection.Collection, pymongo.collection.Collection][source]

Get MongoDBs

Parameters:
  • host (str) – Mongo host IP.

  • username (str, optional) – Username. Defaults to None.

  • password (str, optional) – Password. Defaults to None.

Returns:

beams_col, island_col, comp_col

Return type:

Tuple[Collection, Collection, Collection]

arrakis.utils.database.get_field_db(host: str, epoch: int, username=None, password=None) pymongo.collection.Collection[source]

Get MongoDBs

Parameters:
  • host (str) – Mongo host IP.

  • username (str, optional) – Username. Defaults to None.

  • password (str, optional) – Password. Defaults to None.

Returns:

beams_col, island_col, comp_col

Return type:

pymongo.Collection

arrakis.utils.database.test_db(host: str, username: str | None = None, password: str | None = None) bool[source]

Test connection to MongoDB

Parameters:
  • host (str) – Mongo host IP.

  • username (str, optional) – Mongo username. Defaults to None.

  • password (str, optional) – Mongo password. Defaults to None.

  • verbose (bool, optional) – Verbose output. Defaults to True.

Returns:

True if connection succesful

Return type:

bool

Raises:

Exception – If connection fails.