将一个参数嵌入到活动对象调用中

huangapple go评论49阅读模式
英文:

Embed a parameter into a activity object call

问题

I'm using a json file for reading in config parameters.

{"process_delta":
    {
        "primary_keys": ["id"],
        "schema_name": "schema",
        "table_name": "table",
        "source_path":"folder/table/"
    }
}

Then in my pipeline with a lookup activity I can call the source_path in subgroup process_delta with this:

@activity('Lookup config details').output.firstRow.process_delta.source_path

That works.

My issue is I want to make my pipeline nice and generic to enable reuse, and some existing pipelines don't have the same name for their sections. Is there a way to put a parameter into that formula so the subgroup can be different and still return the source_path value in it?

So like this:

@activity('Lookup config details').output.firstRow.<something_resolved from_a_parameter_here>.source_path

I've tried this but it's not happy with it:

@activity('Lookup config details').output.firstRow.@{pipeline().parameters.p_config_section}.source_path

英文:

I'm using a json file for reading in config parameters.

{&quot;process_delta&quot;:
            {
                &quot;primary_keys&quot;: [&quot;id&quot;],
                &quot;schema_name&quot;: &quot;schema&quot;,
                &quot;table_name&quot;: &quot;table&quot;,
                &quot;source_path&quot;:&quot;folder/table/&quot;
            }
}

Then in my pipeline with a lookup activity I can call the source_path in subgroub process_delta with this:

@activity(&#39;Lookup config details&#39;).output.firstRow.process_delta.source_path

That works.

My issue is want to make my pipeline nice and generic to enable reuse and some existing pipelines don't have the same name for their sections. Is there a way to put a parameter into that formula so the subgroup can be different and still return the source_path value in it?

so like this:

@activity(&#39;Lookup config details&#39;).output.firstRow.&lt;something_resolved from_a_parameter_here&gt;.source_path

I've tried this but its not happy with it

@activity(&#39;Lookup config details&#39;).output.firstRow.@{pipeline().parameters.p_config_section}.source_path

答案1

得分: 1

你可以像下面这样做。

@activity(&#39;Lookup1&#39;).output.firstRow[pipeline().parameters.param1].source_path 

这里我的 param1 值是 &quot;process_delta&quot;

将一个参数嵌入到活动对象调用中

结果:

将一个参数嵌入到活动对象调用中

英文:

You can do like below.

@activity(&#39;Lookup1&#39;).output.firstRow[pipeline().parameters.param1].source_path

Here my param1 value is &quot;process_delta&quot;.

将一个参数嵌入到活动对象调用中

Result:

将一个参数嵌入到活动对象调用中

huangapple
  • 本文由 发表于 2023年6月1日 17:39:15
  • 转载请务必保留本文链接:https://go.coder-hub.com/76380559.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定