Azure Data Factory pustaka untuk Python

Menyusun layanan penyimpanan, pergerakan, dan pemrosesan data ke dalam alur data otomatis dengan Azure Data Factory

Pelajari selengkapnya tentang Data Factory dan mulai membuat pabrik data dan alur menggunakan mulai cepat Python.

Modul manajemen

Buat dan kelola instans Data Factory di langganan Anda dengan modul manajemen.

Penginstalan

Instal paket dengan pip:

pip install azure-mgmt-datafactory 

Contoh

Buat Data Factory di langganan Anda di wilayah US Timur.

from azure.common.credentials import ServicePrincipalCredentials
from azure.mgmt.resource import ResourceManagementClient
from azure.mgmt.datafactory import DataFactoryManagementClient
from azure.mgmt.datafactory.models import *
import time

#Create a data factory
subscription_id = '<Specify your Azure Subscription ID>'
credentials = ServicePrincipalCredentials(client_id='<Active Directory application/client ID>', secret='<client secret>', tenant='<Active Directory tenant ID>')
adf_client = DataFactoryManagementClient(credentials, subscription_id)

rg_params = {'location':'eastus'}
df_params = {'location':'eastus'}  

df_resource = Factory(location='eastus')
df = adf_client.factories.create_or_update(rg_name, df_name, df_resource)
print_item(df)
while df.provisioning_state != 'Succeeded':
    df = adf_client.factories.get(rg_name, df_name)
    time.sleep(1)