bab689
bab689

Reputation: 239

Write to Azure SQL DB from AMLS pipeline

Is there a way to write data to an Azure SQL DB from a pandas dataframe in an Azure Machine Learning Service pipeline using the AMLS python SDK? I know I can input SQL data using register_SQL_ds() and I can save output data as a TabularDataset using OutputTabularDatasetConfig(), but how do I write back to an Azure SQL DB?

Ideally I would like to add new rows and update old rows in an Azure SQL table. But just being able to output the data into a temporary SQL table and doing the add/update step afterwards in SQL would work as well.

Upvotes: 2

Views: 1310

Answers (1)

Ram
Ram

Reputation: 2754

Please follow the below DataTransferStep pointers. Doc: https://learn.microsoft.com/en-us/python/api/azureml-pipeline-steps/azureml.pipeline.steps.data_transfer_step.datatransferstep?view=azure-ml-py Example: https://github.com/Azure/MachineLearningNotebooks/blob/master/how-to-use-azureml/machine-learning-pipelines/intro-to-pipelines/aml-pipelines-data-transfer.ipynb

Note: When copying data to an Azure SQL Database, data will be appended to an existing table. We also expect the source file to have a header row and the names should exactly match with column names in destination table.

Upvotes: 1

Related Questions