def it_should_raise_NotImplementedError() -> None: with pytest.raises(NotImplementedError): a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0]) a.set_connection_string("server", None, "database", "username", "password") a.engine = "PostgreSQL" a.get_db_operations_adapter()
def it_should_raise_NotImplementedError() -> None: with pytest.raises(NotImplementedError): a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0], "server", "database", 0) a.engine = "PostgreSQL" a.build_mssql_adapter_with_integrated_security() a.get_db_operations_adapter()
def it_should_create_the_requested_adapter() -> None: a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0], "server", "database", 0) a.build_mssql_adapter_with_integrated_security() actual = a.get_db_operations_adapter() assert type(actual) is SqlLmsOperations
def it_should_create_the_requested_adapter() -> None: a = MainArguments("some/path", DbEngine.MSSQL, LOG_LEVELS[0]) a.set_connection_string("server", None, "database", "username", "password") actual = a.get_db_operations_adapter() assert type(actual) is MssqlLmsOperations
def main_arguments(adapter: MssqlLmsOperations, csv_path: str) -> MainArguments: args = MainArguments(csv_path=csv_path, engine="mssql", log_level="INFO") args.set_connection_string_using_integrated_security( "localhost", 1433, "test_integration_lms_toolkit") # monkey patch the test adapter args.get_db_operations_adapter = lambda: adapter # type: ignore return args
def main_arguments(adapter: SqlLmsOperations, csv_path: str) -> MainArguments: args = MainArguments( csv_path, "mssql", "INFO", "localhost", "test_integration_lms_toolkit", 1433, False, False, ) args.build_mssql_adapter_with_integrated_security() # monkey patch the test adapter args.get_db_operations_adapter = lambda: adapter # type: ignore return args
def main_arguments( operations_adapter: SqlLmsOperations, csv_path: str, settings: ConnectionSettings ) -> MainArguments: args = MainArguments( csv_path, "postgresql", "INFO", settings.host, settings.db, settings.port, False, False, ) args.db_adapter = operations_adapter.db_adapter # monkey patch the test adapter args.get_db_operations_adapter = lambda: operations_adapter # type: ignore return args
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.")