Exemplo n.º 1
0
 def setUpClass(cls) -> None:
     logging.disable(logging.CRITICAL)
     cls.postgres_testing = testing.postgresql.PostgresqlFactory(cache_initialized_db=True)
     # setup postgres db
     cls.setup_postgres()
     # load all derived classes for the test setup
     CDCBase.load_derived_classes()
     FullLoadBase.load_derived_classes()
     BaseDataBaseOperator.load_derived_classes()
Exemplo n.º 2
0
def initialize():
    """ Initialize the lineage settings """
    # register interrupt signal
    register_ctrl_c_signal()

    # create the logger
    create_rotating_log()
    database_operator_name = configuration.get("conf", "database_operator")
    database_operator_type = configuration.get("conf",
                                               "database_operator_type")
    connection_string = configuration.get("conf", "connection_string")
    load_type = configuration.get("conf", "load_type")
    full_load_plugin_name = configuration.get("conf", "full_load_plugin_name")
    cdc_plugin_name = configuration.get("conf", "cdc_plugin_name")
    table_names_str = configuration.get("conf", "table_names", default="")
    table_names = table_names_str.split(
        ",") if table_names_str.strip() != "" else []
    output_location = configuration.get("conf", "output_location")

    BaseDataBaseOperator.load_derived_classes()
    FullLoadBase.load_derived_classes()
    CDCBase.load_derived_classes()

    print(database_operator_name, database_operator_type, load_type,
          full_load_plugin_name, cdc_plugin_name, table_names_str, table_names,
          output_location)

    database_operator = BaseDataBaseOperator.get_object(
        database_operator_type, database_operator_name)

    database_operator_params = {
        "connection_string": connection_string,
        "load_type": LoadType[load_type],
        "table_names": table_names,
        "full_load_plugin_name": full_load_plugin_name,
        "cdc_plugin_name": cdc_plugin_name,
        "output_location": output_location,
    }

    retry_times = int(configuration.get("conf", "retry_times", 0))
    run_database_operator(database_operator, database_operator_params,
                          retry_times)
Exemplo n.º 3
0
 def test_cdc_base_plugin_load_cdc_default_plugin(self):
     CDCBase.load_derived_classes()
     child_operator_object = CDCBase.get_object("PgDefaultCDCPlugin")
     self.assertEqual(child_operator_object.__dict__["__module__"],
                      "siirto.plugins.cdc.pg_default_cdc_plugin")
     self.assertEqual(child_operator_object.__name__, "PgDefaultCDCPlugin")