Coder Social home page Coder Social logo

kmvinoth / mysql_dump_to_csv_python3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from espenthaem/mysql_dump_to_csv_python3

0.0 0.0 0.0 6 KB

Script to convert a sql file from a mysql dump to csv files for python3, preserving the table name, headers and handling multiple insert statements per table. Largely based on the python2.7 script by jamesmishra, which can be found at https://github.com/jamesmishra/mysqldump-to-csv.

License: MIT License

Python 100.00%

mysql_dump_to_csv_python3's Introduction

MySQL dump to CSV for python3

Background

A quick and dirty python script to convert the SQL file from a mysqldump to multiple csv files for python3

It is largely based on the mysql_dumpt_to_csv project by the GitHub user jamesmishra. I've added a couple of bits of functionality:

  1. The csv files are named according to the table name in the CSV file
  2. The headers of the SQL tables are preserved
  3. Multiple insert statements are handled correctly

Usage

Run python sql_to_csv.py followed by the filename of the SQL file

How It Works

Every line is checked for the 'CREATE TABLE' and 'INSERT INTO' statements. If the first statement is observed, the following lines are extracted to obtain the headers of the SQL table. If the second statement is observed, the rest of the line is converted to CSV.

mysql_dump_to_csv_python3's People

Contributors

espenthaem avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.