Editar

Compartilhar via


Bibliotecas do Azure Data Factory para PythonAzure Data Factory libraries for Python

Compor armazenamento de dados, movimento e serviços de processamento em pipelines de dados simplificados com o Azure Data FactoryCompose data storage, movement, and processing services into automated data pipelines with Azure Data Factory

Saiba mais sobre o Data Factory e comece com o Início Rápido - Criar um data factory e pipeline usando o Python.Learn more about Data Factory and get started with the Create a data factory and pipeline using Python quickstart.

Módulo de gerenciamentoManagement module

Crie e gerencie instâncias do Data Factory em sua assinatura com o módulo de gerenciamento.Create and manage Data Factory instances in your subscription with the management module.

InstalaçãoInstallation

Instale o pacote com pip:Install the package with pip:

pip install azure-mgmt-datafactory 

ExemploExample

Crie um Data Factory em sua assinatura na região Leste dos EUA.Create a Data Factory in your subscription on the East US region.

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)