Hello everyone, Using `OmegaConfigLoader` and pass...
# questions
e
Hello everyone, Using
OmegaConfigLoader
and passing parameters through
extra_params
inside
KedroSession.create
gives me an error:
Copy code
InterpolationKeyError: Interpolation key 'test_ids' not found                                                                                                                                                              
                                 full_key: query_test_recommender_to_filter.sql                                                                                                                                                                         
                                 object_type=dict
The given
extra_params
are a set of strings, which I use in the
catalog.yml
to parameterize a SQL query. Does anyone know how to help me? Thanks in advance
a
Hey, what’s your catalog entry look like? Are you using the
runtime_params:
resolver?
e
Hi, my catalog is like this:
Copy code
query_job_recommender_to_filter:
  type: SQLQueryDataset
  credentials: cred
  sql: " 
      SELECT 
           *
      FROM job
      WHERE id IN (${test_ids})"
I have a method for kedro like below, as I am using FastAPI to request from kedro:
Copy code
def kedro(
        pipeline='',
        tag=[],
        node_names=[],
        from_nodes=[],
        to_nodes=[],
        from_inputs=[],
        to_outputs=[],
        params={}
    ):
    path_name = str(f'{Path(__file__).resolve().parent.parent}/kedro_proj')
    package_name = 'kedro_proj'
    bootstrap_project(path_name)
    os.chdir(path_name)
    

    with KedroSession.create(package_name, extra_params=params) as session:
        return session.run(
                from_nodes=from_nodes,
                to_nodes=to_nodes,
                from_inputs=from_inputs,
                to_outputs=to_outputs,
                pipeline_name=pipeline,
            )
and I call it passing the pipeline name and the params to extra_params.
a
Try using the
runtime_params:
resolver - https://docs.kedro.org/en/stable/configuration/advanced_configuration.html#how-to-override-configuration-with-[…]rameters-with-the-omegaconfigloader
Copy code
query_job_recommender_to_filter:
  type: SQLQueryDataset
  credentials: cred
  sql: " 
      SELECT 
           *
      FROM job
      WHERE id IN (${runtime_params:test_id})"
e
It worked, thank you
🙌 1
🙌🏽 1