def __init__(self):
     self.connection        = init.connect_to_db()
     self.connection_cursor = self.connection.cursor()
Пример #2
0
def test_flat_select():
    """Select all employees no dereferencing"""
    Employee.many()

def test_embedded_document_select():
    """Select all companies no dereferencing"""
    Company.many(projection={'departments': {'$sub': Department}})

def test_full_select():
    """Select all employees and their referenced companies"""
    Employee.many(projection={
        'company': {
            '$ref': Company,
            'departments': {'$sub': Department}
        }
    })


if __name__ == "__main__":

    # Connect to the database
    connect_to_db()

    # Build the test data
    build_test_data()

    # Run the tests
    #time_it(test_flat_select, 100)
    #time_it(test_embedded_document_select, 100)
    time_it(test_full_select, 100)
Пример #3
0
# Define tests


def test_flat_select():
    """Select all employees no dereferencing"""
    list(Employee.objects.no_dereference())


def test_embedded_document_select():
    """Select all companies no dereferencing"""
    list(Company.objects.no_dereference())


def test_full_select():
    """Select all employees and their referenced companies"""
    [e.company for e in Employee.objects]


if __name__ == "__main__":

    # Connect to the database
    connect_to_db()

    # Build the test data
    build_test_data()

    # Run the tests
    #time_it(test_flat_select, 100)
    #time_it(test_embedded_document_select, 100)
    time_it(test_full_select, 100)
 def __init__(self):
     self.connection        = init.connect_to_db()
     self.connection_cursor = self.connection.cursor()
     self.dataset_directory = "../datasets/Netflix_prize_dataset/download"
     self.movie_titles_file = "movie_titles.txt"
     self.training_set_dir  = self.dataset_directory + "/training_set"