简体   繁体   中英

Azure Synapse Notebook Read Variable

I have a vary simple/toy pipeline where I have a pyspark notebook that has an exit value, a set variable activity set to the exit value and a second notebook that is parameterized with the variable. It looks like the below.

在此处输入图像描述

I successfully set the variable, but I cannot seem to read this variable into the input_values notebook. The notebook looks like the below, also quite simple.

在此处输入图像描述

My pipeline parameters then look like the below. However my exit value just comes out as "hello "

在此处输入图像描述

I have also tried accessing the variable directly in the notebook (without parametrization) by f"hello {@variables("my_message")}" , but this resulted in an error. When I try to look at documentation for this type of behavior it generally points to calling a notebook from another notebook so caller/callee notebooks, such as the examples from this documentation . This seems to be backwards for creating a DAG, so I do not want to do that. What I want to do seems possible and I saw an example of something similar here , but I can't seem to get it to work.

Can anyone point me to documentation that would explain how to accomplish what I want or is there something in the above that I am missing?

Edit:

I tried to set the msg parameter to @activity('exit_values').output.status.Output.result.exitValue , which is what I successfully set the my_message variable to and that did not work either.

Success

I don't feel very smart, but I will leave this up for anyone else that might be in the same position. I was setting my msg parameter on the pipeline, not the individual notebook. I successfully ran it by setting the parameter on the notebook.

I successfully ran it by setting the parameter on the notebook.

It is the correct way to pass the values to the Notebook parameters.

In the above the @variables('msg_var') is a should be given to in a dyamic content and not in default value. The pipeline parameters do not support dynamic content here.

在此处输入图像描述

Also, we have to give the value of the Notebook pipeline in Base parameters of Notebook activity by creating a parameter with same name as that.

Here, it supports dynamic content, so give the variable like below.

在此处输入图像描述

Notebook output:

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM