예제 #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]
예제 #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]
예제 #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)])
예제 #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)])
예제 #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)
예제 #6
0
파일: test_base.py 프로젝트: j/bamboo
 def __drop_database(self):
     Database.client().drop_database(TEST_DATABASE_NAME)
예제 #7
0
파일: test_base.py 프로젝트: j/bamboo
 def __create_database(self):
     Database.db(TEST_DATABASE_NAME)
예제 #8
0
 def __drop_database(self):
     Database.client().drop_database(TEST_DATABASE_NAME)
예제 #9
0
 def __create_database(self):
     Database.db(TEST_DATABASE_NAME)
예제 #10
0
파일: test_base.py 프로젝트: helioid/bamboo
 def _drop_database(self):
     Database.connection().drop_database(TEST_DATABASE_NAME)