Esempio n. 1
0
def mssql_connection(request) -> Iterable[Connection]:
    """
    Fixture that sets up a connection to use, and migrate the tables.
    Assumes existence of local SQLServer DB named 'test_integration_lms_toolkit'
    """
    adapter = _new_mssql_adapter(request)
    migrate(adapter)

    connection = adapter.engine.connect()
    yield connection
    connection.close()
Esempio n. 2
0
def mssql_connection() -> Iterable[Connection]:
    """
    Fixture that sets up a connection to use, and migrate the tables.
    Assumes existence of local SQLServer DB named 'test_integration_lms_toolkit'
    """
    engine = _new_mssql_engine()
    migrate(engine)

    connection = engine.connect()
    yield connection
    connection.close()
Esempio n. 3
0
def pgsql_connection(request) -> Iterable[Connection]:
    """
    Fixture that sets up a connection to use, and migrate the tables.
    Creates the test database if it does not yet exist.
    """
    settings = GetSettings(request)

    adapter = create_postgresql_adapter(settings.user, settings.password,
                                        settings.host, settings.db,
                                        settings.port)

    if not database_exists(adapter.engine.url):
        create_database(adapter.engine.url)

    migrate(adapter, DbEngine.POSTGRESQL)

    connection = adapter.engine.connect()
    yield connection
    connection.close()
Esempio n. 4
0
def run_loader(arguments: MainArguments) -> None:
    logger.info("Begin loading files into the LMS Data Store (DS)...")

    migrator.migrate(arguments.get_db_engine())

    csv_path = arguments.csv_path

    db_adapter = arguments.get_db_operations_adapter()

    _load_users(csv_path, db_adapter)
    _load_sections(csv_path, db_adapter)
    # Important: run this immediately after loading sections, before loading other section-related resources
    _load_section_associations(csv_path, db_adapter)
    _load_assignments(csv_path, db_adapter)
    _load_assignment_submissions(csv_path, db_adapter)
    _load_attendance_events(csv_path, db_adapter)
    _load_section_activities(csv_path, db_adapter)
    _load_system_activities(csv_path, db_adapter)

    logger.info("Done loading files into the LMS Data Store.")