Import Mysql CSV files

Asked

Viewed 821 times

1

I am using Xampp as a server and Mysqlworkbench as a database, how can I import a csv file for various experiments (file size, upload time, etc)?

1 answer

2


There are many ways for you to do this, but regardless of any adopted form, you will first have to create the table with the given structure (columns and fields) so that you populate it with the CSV file or any other that you want to import.

I think this tutorial can help you Importing cvs into mysql

Mysql has a command to import a CSV file directly into a table (and seems to be very fast).

LOAD DATA INFILE 'arquivo' INTO TABLE 'tabela'

Another tutorial in Portuguese

  • paulo Roberto thank you, and how I test for example on import how many Gb the . csv can contain?

  • 2

    @Rodrigo there is no size limitation... Since you have not determined this in the script, it will import exactly everything in the spreadsheet.

  • then basically there are no restrictions on size and if you have a heavier file it takes longer to process and vice versa? So what are the pros/cons of importing such files (that can be tested)?

  • 2

    @Rodrigo this is good for when you already have a spreadsheet with a lot of information and do not want to risk losing them, then you import them to the bank and use only the columns you really need, but having the other information not so useful kept together in the bank. I don’t see any negative points except the delay in processing if the spreadsheet is too long, but this is not an obstacle for today’s micros... You can test N conditions, as if it imported duplicate chaos information you have import again, get corrupted due to csv size and etc.

  • 1

    Exactly what you referred to corrupts due to the size of csv means what then is limited to size? That’s the part I don’t understand

  • 2

    @Rodrigo I am giving you this condition so that you test if He has corrupted if you take a large file, it will not be a limitation of the bank should it run, it will be a limitation of the processing capacity of your micro... Read a little about importing CSV and you will see that you have many circumstances to be tested, since your goal is to learn... Va putting your doubts on the site, we will respond as far as possible. Do not forget to vote as a response.

  • thank you very much I think I understand!

  • when trying to import a csv file from me pc this error: error Calling Python module Function what sera?

  • @Rodrigo open a new question to this error, please.

Show 4 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.