A flexible CLI tool to convert ,preferably, data (JSON/CSV) into SQL tables.
pip install -r requirements.txtBasic usage:
python main.py convert --file input.json --table player_statsOptions:
--file: Input JSON or CSV file (required)--format: Input format (json/csv, auto-detected if not specified)--table: Name of the SQL table to create (required)--output: Output file (.sql) or database URL (e.g. sqlite:///out.db)--preview: Preview the inferred schema--interactive: Interactively confirm or modify field types
Examples:
- Preview schema before conversion:
python main.py convert --file stats.json --table player_stats --preview- Write to SQLite database:
python main.py convert --file stats.csv --table match_stats --output sqlite:///football.db- Interactive schema modification:
python main.py convert --file player.json --table players --interactive- Automatic schema inference from JSON/CSV data
- Support for basic SQL types (TEXT, INTEGER, REAL, DATE, BOOLEAN)
- Interactive schema modification
- Output to .sql file or direct database insertion(PostgreSQL/
- Cross-platform support
The codebase is structured as follows:
cli.py: Command-line interface using Clickcore.py: Core data processing and SQL generationutils.py: Utility functions for validation and type inference
MIT