arrakis.utils.database
Database utilities
Functions
|
Get MongoDBs |
|
Get MongoDBs |
|
Get MongoDBs |
|
Test connection to MongoDB |
|
Validate field and sbid pair |
Module Contents
- 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.
- arrakis.utils.database.validate_sbid_field_pair(field_name: str, sbid: int, field_col: pymongo.collection.Collection) bool [source]
Validate field and sbid pair
- Parameters:
field_name (str) – Field name.
sbid (int) – SBID.
field_col (Collection) – Field collection.
- Raises:
bool – If field name and sbid pair is valid.