def populate(session_factory, data_path, data_filename):
    filename = os.path.join(data_path, data_filename)
    movie_file_reader = MovieFileCSVReader(filename)
    movie_file_reader.read_csv_file()

    session = session_factory()
    for director in movie_file_reader.dataset_of_directors:
        session.add(director)
    for movie in movie_file_reader.dataset_of_movies:
        session.add(movie)
    filename = os.path.join(data_path, "users.csv")
    users_file_reader = MovieFileCSVReader(filename)
    users_file_reader.read_csv_file_users()

    for user in users_file_reader.dataset_of_users:
        session.add(user)

    session.commit()
Пример #2
0
def load_directors(data_path: str, repo: MemoryRepository):
    movie_file_reader = MovieFileCSVReader(data_path)
    movie_file_reader.read_csv_file()
    for dict in movie_file_reader.dataset_of_directors:
        repo.add_director(dict)
Пример #3
0
def load_genres(data_path: str, repo: MemoryRepository):
    movie_file_reader = MovieFileCSVReader(data_path)
    movie_file_reader.read_csv_file()
    for genre in movie_file_reader.dataset_of_genres:
        repo.add_genre(genre)
Пример #4
0
def load_movies(data_path: str, repo: MemoryRepository):
    tags = dict()
    movie_file_reader = MovieFileCSVReader(data_path)
    movie_file_reader.read_csv_file()
    for data_row in movie_file_reader.dataset_of_movies:
        repo.add_movie(data_row)
Пример #5
0
def main():
    filename = 'datafilereaders/datafiles/Data1000Movies.csv'
    movie_file_reader = MovieFileCSVReader(filename)
    movie_file_reader.read_csv_file()