Azure Data Factory bibliotek för Python

Skapa datalagrings-, flytt- och bearbetningstjänster till automatiserade datapipelines med Azure Data Factory

Läs mer om Data Factory och kom igång med snabbstarten Skapa en datafabrik och pipeline med Python.

Hanteringsmodul

Skapa och hantera Data Factory-instanser i din prenumeration med hanteringsmodulen.

Installation

Installera paketet med pip:

pip install azure-mgmt-datafactory 

Exempel

Skapa en Data Factory i din prenumeration i regionen USA, östra.

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)