Nicholas Chammas
07/09/2021, 4:22 PMParameter
directly to a DatabricksRunNow
task, Prefect detects the dependency and passes the information from the parameter to the task correctly. e.g.
path = Parameter("path")
DatabricksRunNow(...)(
databricks_conn_secret=SECRET,
notebook_params: {
"path": path,
}.
)
However, if I plug the parameter into a formatted string, for example, the information is no longer passed from the parameter to the task correctly.:
path = Parameter("path")
DatabricksRunNow(...)(
databricks_conn_secret=SECRET,
notebook_params: {
"path": f"{path}",
}.
)
In this case, the parameter class instance is plugged into the string vs. the actual parameter value that we want. So the notebook is given a repr()
of a Parameter
class instance — which is unusable, of course — instead of the string value of the parameter that we actually want.
Why is that, and is there a way around this?Nicholas Chammas
07/09/2021, 4:35 PMKevin Kho
Kevin Kho
"path": task(lambda x: f"{x}")(path)
Nicholas Chammas
07/09/2021, 4:41 PMList
and Dict
tasks?Kevin Kho
(x[0], x["test"])
are also evaluated immediately like the f-string
so the execution of these is not deferred so you can’t do these in the Flow block if x
is the output of a task inside the Flow.