How can I automate a CSV import to Azure MySQL?

a8ree1 21 Reputation points
2021-02-08T14:09:05.393+00:00

I cannot seem to find a way in which to import a CSV file to Azure MySQL from a command line.

I've tried using LOAD DATA LOCAL but even with the csv on a storage account with the drive mapped, it won't work

Error 2068 (HY000): Load Data Local Infile request rejected due to restrictions on access.

How can I import from a CSV? I want to run the import via a devops pipeline - my source is in Github.

Thanks

Azure Database for MySQL
Azure Database for MySQL
An Azure managed MySQL database service for app development and deployment.
824 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Navtej Singh Saini 4,226 Reputation points Microsoft Employee
    2021-02-09T01:08:51.913+00:00

    @a8ree1 - Here is a ready solution for this:

    1.Your client will copy the CSV files from local machine to Azure Storage using AzCopy.

    AzCopy

    2.At your end, you can use Azure Data Factory to create a pipeline in order to copy that data from storage to MySQL database once or repeatedly on schedule.

    ADF Pipeline

    The second link above have all instructions and a button to directly deploy a pipeline to accomplish this task. Please let us know if you have any questions.

    Regards
    Navtej S

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.