Code Monkey home page Code Monkey logo

csv-sql's Introduction

CSV-SQL

A simple CLI tool to generate SQL tables from CSV files

  • CSV-SQL will generate SQL table creation statements from CSV files, currently with TEXT data types only.
  • CSV-SQL outputs to stdout. You can redirect the output to a file.

Usage

Generate SQL table creation statements from CSV files

  • The name of the CSV file will be used as the name of the table.
csv-sql [FILE_PATHS]...

Generate only the schema without inserting data

csv-sql --schema-only [FILE_PATHS]...

Add a serial primary key

csv-sql --primary-key=smallint [FILE_PATHS]...
csv-sql --primary-key=integer [FILE_PATHS]...
csv-sql --primary-key=bigint [FILE_PATHS]...

Merge multiple tables into one

csv-sql --merge [FILE_PATHS]...

Redirect output to a file

csv-sql [FILE_PATHS]... > output.sql

See all options

csv-sql --help

Development

Use just for easy development.

See all available commands

just -l

Build and run

just dev ~/Dir/file.csv
just dev "--schema-only ~/Dir/file.csv ~/Dir/file2.csv ~/Dir/file3.csv"

Clear all *.sql files in current directory

just clear

TODO

  • Generate SQL table creation statements from CSV files with headers and TEXT data types
  • Output to stdout
  • Schema only without inserting data
  • merge multiple CSV files into one SQL table
  • Automatic data type detection
  • Custom data types
  • Primary keys
    • Auto increment
    • Custom
  • Constraints
  • Foreign keys

Contact

csv-sql's People

Watchers

Jakub Stibůrek 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.