Home > Software design >  MariaDB losing data when importing CSV
MariaDB losing data when importing CSV

Time:05-10

I'm trying to import a CSV file into MariaDB.

I've created the table with "varchar(300)" for each field, so it's not missing space. Also, when I loaded the file I used " FIELDS TERMINATED BY ';'LINES TERMINATED BY '\r\n' "

My first thought was that the '';'' in the CSV could be causing that, since I got a lot of 1262 warnings (Row 2 was truncated; it contained more data than there were input columns). But the rows that contain additional ";" are still being imported, so I have no clue about what is going on.

CSV file:

CSV file

The last row (13784) was not imported to MariaDB, but the two above were. And I couldn't see the difference between them.

I'm really confused because the Excel file has 3677 lines of data, and only 3309 are being imported.

Update:

Table Definition: https://prnt.sc/Wrzdr6GjZI4e

Engine: Server version: 10.3.34-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Collation: https://prnt.sc/5qdCr9Fo7pBB

Character Set: https://prnt.sc/qA7rc2EmWV1n

CodePudding user response:

When transforming the Excel file into CSV I wasn't using CSV UTF-8. Once I did this I've lost 0% of the data imported.

  • Related