https://kedro.org/ logo
#questions
Title
# questions
t

tom kurian

03/26/2024, 5:18 PM
Hello Team, I'm working on a use case that involves creating n nodes based on a tuning parameter x. Currently, we're using a Jinja template for this purpose. However, since I'm planning to migrate to Kedro 0.19, I need to implement this without using Jinja. Currently, we achieve this using loops in Python. For example: _*Node_A_{n}, where n ranges from 1 to x.*_ I'm exploring if there's a more efficient way to accomplish this task without relying on Python loops.
n

Nok Lam Chan

03/26/2024, 5:37 PM
Hi @tom kurian, why would you need Jinja for creating node in the first place? Can you explain a little bit more how it works?
t

tom kurian

03/26/2024, 5:41 PM
we were doing something like this, in a node.j2 file {% for n in range(i) %} node_a.{{ n }}_some: func: some_function inputs: data: master_table outputs: sample.{{ n }}_tokens_sample
n

Nok Lam Chan

03/26/2024, 6:21 PM
Thanks. This looks more like a plugin specific feature so you may have better chance to ask the author about this plugin. You should be able to do this directly in a Python file already. I don't think there are new feature that can help this directly . The dataset factory look kind of similar but they are for the Data Catalog not nodes.
👍 1