Dein Dein - 27 days ago 8
MySQL Question

Move Data from Blob to SQL Database

I am currently in the process of moving my sensor reading data from my Azure Blob storage into a SQL database. I have multiple .csv files and in those files I have various columns that holds the date ( in the format: 25/4/2017), time, sensor_location and sensor_readings.
My question; If I want to store the data according to their respective columns using Logic App, what step should I take? and how do I push the second file data into the row after the first file data? Thanks

Answer Source

You will need to either write a script, (any high level language which has support or extensions for mysql will do, python, php, nodejs, etc) to import your data or you can use a mysql client like sequelpro https://www.sequelpro.com/ which imports csv files.

Here is a link as to how to insert data into mysql with php: http://php.net/manual/en/pdo.prepared-statements.php You can read the csv file with:

$contents = file_get_contents('filename.csv');
$lines = explode("\n", $contents);
foreach($lines as $line) { ... 
// insert all rows to mysql here