Exemplo n.º 1
0
    def set_collection(cls, collection_name):
        """Return a MongoDB collection for the passed name.

        :param collection_name: The name of collection to return.

        :returns: A MongoDB collection from the current database.
        """
        return Database.db()[collection_name]
Exemplo n.º 2
0
    def set_collection(cls, collection_name):
        """Return a MongoDB collection for the passed name.

        :param collection_name: The name of collection to return.

        :returns: A MongoDB collection from the current database.
        """
        return Database.db()[collection_name]
Exemplo n.º 3
0
def ensure_indexing():
    """Ensure that bamboo models are indexed."""
    db = Database.db()
    calculations = db.calculations
    datasets = db.datasets
    observations = db.observations
    datasets.ensure_index([(DATASET_ID, ASCENDING)])
    # The encoded dataset_id will be set to '0'.
    observations.ensure_index([("0", ASCENDING)])
    observations.ensure_index([(Observation.ENCODING_DATASET_ID, ASCENDING)])
    calculations.ensure_index([(DATASET_ID, ASCENDING)])
Exemplo n.º 4
0
def ensure_indexing():
    """Ensure that bamboo models are indexed."""
    db = Database.db()
    calculations = db.calculations
    datasets = db.datasets
    observations = db.observations
    datasets.ensure_index([
        ("BAMBOO_RESERVED_KEY_dataset_id", ASCENDING),
        ("BAMBOO_RESERVED_KEY_dataset_observation_id", ASCENDING)])
    observations.ensure_index([
        ("BAMBOO_RESERVED_KEY_dataset_observation_id", ASCENDING)])
    calculations.ensure_index([("BAMBOO_RESERVED_KEY_dataset_id", ASCENDING)])
Exemplo n.º 5
0
def ensure_indexing():
    """Ensure that bamboo models are indexed."""
    db = Database.db()

    # collections
    calculations = db.calculations
    datasets = db.datasets
    observations = db.observations

    # indices
    bamboo_index(datasets, DATASET_ID)
    bamboo_index(observations, ENCODED_DATASET_ID)
    bamboo_index(observations, Observation.ENCODING_DATASET_ID)
    bamboo_index(calculations, DATASET_ID)
Exemplo n.º 6
0
 def __drop_database(self):
     Database.client().drop_database(TEST_DATABASE_NAME)
Exemplo n.º 7
0
 def __create_database(self):
     Database.db(TEST_DATABASE_NAME)
Exemplo n.º 8
0
 def __drop_database(self):
     Database.client().drop_database(TEST_DATABASE_NAME)
Exemplo n.º 9
0
 def __create_database(self):
     Database.db(TEST_DATABASE_NAME)
Exemplo n.º 10
0
 def _drop_database(self):
     Database.connection().drop_database(TEST_DATABASE_NAME)