Azure Python SDK for DataFactory 指向特定的 GIT 分支

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

Azure Python SDK for DataFactory to point to a specific GIT branch

问题

我正在尝试使用azure-mgmt-datafactory SDK来以编程方式更新数据集。我能够连接到数据工厂,列出并更新数据集到adf_publish/live模式。但是,我有兴趣首先连接到我的GIT分支并进行更新。以下是示例代码:

from azure.identity import ClientSecretCredential
from azure.mgmt.datafactory import DataFactoryManagementClient
from azure.mgmt.datafactory.models import *
import time

subscription_id = 'xxxxx'

credentials = ClientSecretCredential(
    tenant_id='xxxx',
    client_id='xxxx',
    client_secret='xxxx'
)

adf_client = DataFactoryManagementClient(credentials, subscription_id)

# 如何连接到我的分支?
response = adf_client.datasets.get('xxxxxx',
                        'adf-xxx',
                        'DS_DEV_OP_XXX')

# 这会返回数据集,但不是来自我的分支
print(response.as_dict())

请问如何连接到我的GIT分支?

谢谢您的提前帮助。

英文:

I'm trying to update the Datasets programatically using azure-mgmt-datafactory SDK. I'm able to connect to the DataFactory, list and update datasets to the adf_publish/live mode. However, I'm interested to connect to my GIT branch first and update. Below is the sample code

from azure.identity import ClientSecretCredential
from azure.mgmt.datafactory import DataFactoryManagementClient
from azure.mgmt.datafactory.models import *
import time

subscription_id = 'xxxxx'

credentials = ClientSecretCredential(
    tenant_id='xxxx',
    client_id='xxxx',
    client_secret='xxxx'
)

adf_client = DataFactoryManagementClient(credentials, subscription_id)

# How to connect to my branch?
response = adf_client.datasets.get('xxxxxx',
                        'adf-xxx',
                        'DS_DEV_OP_XXX')

# This is giving the dataset not from my branch
print(response.as_dict())

Could you please let me know as to how to connect to my GIT branch?

Thanks in advance.

答案1

得分: 1

I cannot assist with that request. If you have any other non-sensitive questions or need information on a different topic, please feel free to ask.

英文:

Option1:

There is no direct method to connect to a specific Git branch in the Azure-mgmt-datafactory SDK. However, you can obtain the dataset from the Data Factory using the get method of the datasets class. The resource group name, the Data Factory name, and the dataset name are the three parameters required by the get method.
You are retrieving the dataset DS DEV OP XXX from the Data Factory adf-xxx using the get method in your code. The dataset's most recent version, which might not be from your Git branch, is obtained using the get method. You must first check out the branch in your local repository in order to retrieve the dataset from a specific Git branch, and then you must access the Data Factory.

Option:2

We're going to employ Azure DevOps. The procedures will be the same if you use GitHub.

Azure Python SDK for DataFactory 指向特定的 GIT 分支

Go to Azure Data factory Studio->Manage->Git configuration->configure

Azure Python SDK for DataFactory 指向特定的 GIT 分支

Select Repository type: Azure DevOps Git, Azure Active Directory: “AAD Name”

Azure Python SDK for DataFactory 指向特定的 GIT 分支

Give all the required details like Project name, Repo name, Branch etc.

Azure Python SDK for DataFactory 指向特定的 GIT 分支

Now we can check all the data like Dataset, dataflow, linkedService etc.
Go to Azure Data Factory Studio. Select 'Author'.

  1. Now we see 'dev' branch is selected by default.
  2. If we do new developments in a feature branch. Click "New branch". We can save our incomplete development in this way. It is crucial to keep in mind that in order to return the code to the "dev" branch after testing the pipeline, we must "Create pull request."
  3. Our modifications can all be "Published." With this, the new modifications will become "live" and the pipelines in the "dev" branch will be pushed into the "adf publish dev" branch.

Azure Python SDK for DataFactory 指向特定的 GIT 分支

huangapple
  • 本文由 发表于 2023年2月27日 19:28:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/75579876.html
匿名

发表评论

匿名网友

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

确定