This Project facilitates the conversion of Excel files to SQLite databases and provides functionality to execute SQL queries on the generated database. Additionally, it includes converting natural language text to SQL queries using state-of-the-art models. We have implemented two primary models, namely CodeLlama and SQLCoder, to perform this task.
Python
1
10 commits
updated Mar 3, 2024
This Project facilitates the conversion of Excel files to SQLite databases and provides functionality to execute SQL queries on the generated database. Additionally, it includes converting natural language text to SQL queries using state-of-the-art models. We have implemented two primary models, namely CodeLlama and SQLCoder, to perform this task.
excel_db.py: Python script for converting Excel data to a database. inventory.xlsx: Sample Excel file containing inventory data (input file). inventory.db: SQLite database file created by the script (output file). nsql.py:This Python script generates SQL queries based on user prompts and executes them on a SQLite database. It utilizes a pre-trained language model to convert natural language instructions into SQL queries.
CodeLlama
SQLCoder
However, while SQLCoder2 model can be quantized to 4-bit, 8-bit and 16 bit only 4-bit and 8-bit quantization operations are currently supported.
We seamlessly integrate SQLite 3, a lightweight relational database, offering efficient data storage and retrieval. Leveraging its simplicity and reliability, we ensure robust database operations for our system
Database 1
Database 2
Database 3
Environment Setup Create Virtual Environment: Set up a virtual environment using Python's built-in venv module.
python -m venv myenv
Activate Virtual Environment: Activate the virtual environment to isolate dependencies.
On Windows:
myenv\Scripts\activate
On macOS and Linux:
source myenv/bin/activate
Install Required Packages: Install the necessary packages using pip.
pip install -r requirements.txt
Prepare your data in an Excel file named inventory.xlsx (or any other desired name).
Execute the Python script excel_db.py. The script will read the Excel file, convert it to CSV format, and create an SQLite database file (inventory.db) with corresponding tables.
python excel_db.py
Check Database After execution, you will find the generated SQLite database file (inventory.db) containing the converted data. Execute SQL Queries To execute SQL queries on the generated database, run the script nsql.py.
python nsql.py
Follow the prompts to input your SQL query and interact with the database.
Note
sqlite: (https://druid.apache.org/docs/latest/design/)
hugginface: (https://huggingface.co/docs/transformers/index)
This Project facilitates the conversion of Excel files to SQLite databases and provides functionality to execute SQL queries on the generated database. Additionally, it includes converting natural language text to SQL queries using state-of-the-art models. We have implemented two primary models, namely CodeLlama and SQLCoder, to perform this task.
Python
1
10 commits
updated Mar 3, 2024
This Project facilitates the conversion of Excel files to SQLite databases and provides functionality to execute SQL queries on the generated database. Additionally, it includes converting natural language text to SQL queries using state-of-the-art models. We have implemented two primary models, namely CodeLlama and SQLCoder, to perform this task.
excel_db.py: Python script for converting Excel data to a database. inventory.xlsx: Sample Excel file containing inventory data (input file). inventory.db: SQLite database file created by the script (output file). nsql.py:This Python script generates SQL queries based on user prompts and executes them on a SQLite database. It utilizes a pre-trained language model to convert natural language instructions into SQL queries.
CodeLlama
SQLCoder
However, while SQLCoder2 model can be quantized to 4-bit, 8-bit and 16 bit only 4-bit and 8-bit quantization operations are currently supported.
We seamlessly integrate SQLite 3, a lightweight relational database, offering efficient data storage and retrieval. Leveraging its simplicity and reliability, we ensure robust database operations for our system
Database 1
Database 2
Database 3
Environment Setup Create Virtual Environment: Set up a virtual environment using Python's built-in venv module.
python -m venv myenv
Activate Virtual Environment: Activate the virtual environment to isolate dependencies.
On Windows:
myenv\Scripts\activate
On macOS and Linux:
source myenv/bin/activate
Install Required Packages: Install the necessary packages using pip.
pip install -r requirements.txt
Prepare your data in an Excel file named inventory.xlsx (or any other desired name).
Execute the Python script excel_db.py. The script will read the Excel file, convert it to CSV format, and create an SQLite database file (inventory.db) with corresponding tables.
python excel_db.py
Check Database After execution, you will find the generated SQLite database file (inventory.db) containing the converted data. Execute SQL Queries To execute SQL queries on the generated database, run the script nsql.py.
python nsql.py
Follow the prompts to input your SQL query and interact with the database.
Note
sqlite: (https://druid.apache.org/docs/latest/design/)
hugginface: (https://huggingface.co/docs/transformers/index)