https://github.com/piotrgredowski/table2sql
Python CLI tool which allows you to convert file (CSV or Excel) with table to SQL insert statements.
https://github.com/piotrgredowski/table2sql
csv excel insert sql table xlsx
Last synced: 2 months ago
JSON representation
Python CLI tool which allows you to convert file (CSV or Excel) with table to SQL insert statements.
- Host: GitHub
- URL: https://github.com/piotrgredowski/table2sql
- Owner: piotrgredowski
- Created: 2021-08-07T14:39:00.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-06-29T17:15:37.000Z (over 3 years ago)
- Last Synced: 2025-10-11T23:22:39.689Z (6 months ago)
- Topics: csv, excel, insert, sql, table, xlsx
- Language: Python
- Homepage:
- Size: 581 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# table2sql
[](https://github.com/piotrgredowski/table2sql/actions/workflows/ci.yml)
[](https://sonarcloud.io/dashboard?id=piotrgredowski_table2sql)
[](https://codecov.io/gh/piotrgredowski/table2sql)
[](https://github.com/piotrgredowski/table2sql/actions/workflows/codeql-analysis.yml)
[](https://badge.fury.io/py/table2sql)
Python CLI tool which allows you to convert file with table (CSV and Excel) to SQL insert statements.
[Docs](https://gredowski.com/table2sql/)
## Basic usage
`some.csv`
```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:
```bash
table2sql some.csv --output-table some.table --has-types-row
```
Result:
```sql
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
```bash
pip install table2sql
```