Skip to content

json2sqlite is a tool that allows importing data from a JSON file into an SQLite database

License

Notifications You must be signed in to change notification settings

stefanopaolonii/json2sqlite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

json2sqlite πŸš€

Description πŸ“„

json2sqlite is a tool that allows importing data from a JSON file into an SQLite database. This project is useful for anyone who wants to transfer structured data from a JSON format to a relational database quickly and easily.

Project Structure πŸ“

The project structure is as follows:

json2sqlite/
β”‚-- data/
β”‚   β”œβ”€β”€ data.json  # JSON file to be imported (to be placed manually in this directory)
β”‚-- src/
β”‚   β”œβ”€β”€ __init__.py         # Module initialization file
β”‚   β”œβ”€β”€ config.py           # Database and JSON file configuration
β”‚   β”œβ”€β”€ json_reader.py      # Module for reading the JSON file
β”‚   β”œβ”€β”€ logger.py           # Module for log management
β”‚   β”œβ”€β”€ main.py             # Main script for data import
β”‚   β”œβ”€β”€ sqlite_handler.py   # Module for SQLite database management
β”‚-- README.md               # Project documentation

Requirements πŸ“‹

  • Python 3.x
  • Python modules: sqlite3, json, logging

Installation πŸ’»

  1. Clone the repository:
    git clone https://github.com/stefanopaolonii/json2sqlite.git
    cd json2sqlite

Configuration βš™οΈ

Edit the config.py file to specify:

  • The path to the JSON file (which must be placed in the data/ directory)
  • The name of the SQLite database
  • The name of the table

Example configuration:

DB_FILE = 'database.sqlite'
TABLE_NAME = 'my_table'
JSON_FILE = 'data/data.json'

Usage ▢️

To run the script and import the JSON data into the SQLite database, execute the following command:

python -m src.main

License πŸ“œ

This project is distributed under the MIT license. See the LICENSE file for more details.

About

json2sqlite is a tool that allows importing data from a JSON file into an SQLite database

Topics

Resources

License

Stars

Watchers

Forks

Languages