Hello, I'm using op factory to load several table...
# ask-community
s
Hello, I'm using op factory to load several tables with their respective queries. How do I pass date from a schedule to perform incremental load? This is the op factor I'm trying to pass the date on to:
Copy code
def run_query_op_factory(job_name,table):
    @op(name=job_name)
    def _run_query(context):
        fd = open(f'batch/batch_tables/query_{table}.sql', 'r')
        sqlFile = fd.read()
        fd.close()
        params = (context.op_config["since_date"],)
        data = wms.execute_query(sqlFile, params)
        return data
    return _run_query
In the schedular I tried dynamically creating the config, but it is not showing up.
o
hi @Shameel Faraz! you'll want to define a
config_schema={"since_date": str}
when creating your op. from there, you can pass in run_config when creating a RunRequest in your sensor i.e.
yield RunRequest(..., run_config={"since_date": "2023-01-01"})