Skip to content

Python CLI tool which allows you to convert file (CSV or Excel) with table to SQL insert statements.

Notifications You must be signed in to change notification settings

piotrgredowski/table2sql

Repository files navigation

table2sql

CI Quality Gate Status codecov CodeQL

PyPI version

Python CLI tool which allows you to convert file with table (CSV and Excel) to SQL insert statements.

Docs

Basic usage

some.csv

a,b,c,d
int,str,float,sql
1,2,3,(SELECT id FROM another.table WHERE name = 'Paul')
5,6,7,(SELECT id FROM another.table WHERE name = 'Paul')

Command:

table2sql some.csv --output-table some.table --has-types-row

Result:

INSERT INTO some.table (a, b, c, d)
VALUES (1, '2', 3.0, (SELECT id FROM another.table WHERE name = 'Paul')), (5, '6', 7.0, (SELECT id FROM another.table WHERE name = 'Paul'));

Install

pip install table2sql

About

Python CLI tool which allows you to convert file (CSV or Excel) with table to SQL insert statements.

Topics

Resources

Stars

Watchers

Forks

Languages