Exemple #1
0
def common_task_1_repository() -> CommonTask1Repository:
    """ Fixture that makes CommonTask1Table Repository using local sqlite db """
    engine = db_utils.create_db_engine(login=None,
                                       password=None,
                                       host=DB_NAME,
                                       schema=None,
                                       conn_type='sqlite')

    return CommonTask1Repository(engine=engine)
Exemple #2
0
def ml_dag_repository() -> MLDagRepository:
    """ Fixture that makes MLDagTable using local sqlite db """
    engine = db_utils.create_db_engine(login=None,
                                       password=None,
                                       host=DB_NAME,
                                       schema=None,
                                       conn_type='sqlite')

    return MLDagRepository(engine=engine)
Exemple #3
0
    def __init__(self, engine: Engine):
        # Bind engine to metadata only if it is not bind already
        if self.metadata.bind is None:
            # Skip engine building if it is already provided
            if engine is None:
                connection = BaseHook.get_connection(
                    conn_id=settings.DB_CONN_ID)

                engine = db_utils.create_db_engine(
                    login=connection.login,
                    password=connection.password,
                    host=connection.host,
                    schema=connection.schema,
                    conn_type=connection.conn_type)

            self.metadata.bind = engine