If it is an input Data Node, you can change the query before submitting a scenario:
scenario = tp.create_scenario(sc_config)
scenario.month.write("JAN")
scenario.month_data.read_query = f"SELECT * from mytable where MONTH={scenario.month.read()}"
scenario.submit()
Could you describe your use case? Is your SQL Data Node an Input Data Node, and would it solve your issue?
If it is not an input, the case is more complex.
We can add a functionality to SQL data nodes in Taipy. Something similar to write_query_builder. A new property called read_query_builder. This builder would be a function executed at runtime before reading the data to build the query. You will need to change it at runtime too.
scenario = tp.create_scenario(sc_config)
def scenario_read_query_builder(scenario):
return f"SELECT * from mytable where MONTH={scenario.month.read()}"
scenario.month_data.read_query_builder = scenario_read_query_builder
scenario.submit()
scenario.month_data.read()
The complexity comes from the fact that this query builder must have a generic signature since it is called automatically by the Taipy orchestrator. Plus, it must be serializable, so we can't really use partials here.