MySQL Import millions Data schema summary

Source: Internet
Author: User
Tags mysql import python script

Business data from the company headquarters, background data settings are exported by day CSV, but the analysis of the business needs to see the entire time trend, Excel has been dead, only on MySQL, with SQL statement query. In fact, the load data local infile can be done, the trouble is that there are too many table header fields, and may change, do not want to write a script every time first create table structure and re-guide data. Is there any way to automatically handle the header?

First, using Nevicat or Workbench

There are options for importing data that can help automatically detect data types and generate headers.
After testing, using the graphical interface to import data, the speed is very slow, this scheme does not work.

Second, write the command line interactive prompt script

The Python script reads the CSV header file, then generates the SQL statement based on the field name and the first row of data, and then even MySQL. In short, it's a python automation. This program can, need to write code.

Iii. Comprehensive Law

Read only the first three data in the table, save the file, and then workbench the import, generate the table data, and then load on the local data infile.

MySQL Import millions Data schema summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.