This Python script provides functions to generate SQL queries based on input questions and database schemas using a pre-trained language model.
Project description
README.md
tabqa: Natural Language to SQL Query Converter
Overview
This Python library enables the conversion of natural language queries into SQL queries. It simplifies the process of querying databases by allowing users to express their queries in everyday language.
Installation
You can install the package via pip:
pip install tabqa
Example Usage
from tabqa import sql_model, generate_schema
# Define the natural language question
question = "Count Number products"
# Path to the SQL file containing the database schema
file_path = "schema.sql"
# Initialize the SQL model
model = sql_model()
# Generate the SQL schema from the natural language question
result = generate_schema(question, file_path, model)
# Print the generated SQL query
print(result)
How to Use
- Import the necessary functions from
tabqa. - Define your natural language question.
- Provide the path to the SQL file containing your database schema.
- Initialize the SQL model.
- Use
generate_schema()function to convert the natural language question into an SQL query. - Print or use the generated SQL query as needed.
Contribution
Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.
License
This project is licensed under the MIT License.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tabqa-0.1.1.tar.gz.
File metadata
- Download URL: tabqa-0.1.1.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7369ff9e2741f7a936b884b421688f5dbe0f67a05deba01aa07d9e2771a5036d
|
|
| MD5 |
1dbcd1cbd0e78585dfdc711030e32756
|
|
| BLAKE2b-256 |
a48ed376667458ae20dcf866aa908f13501f151be64586da2692a1a4f24687a8
|
File details
Details for the file tabqa-0.1.1-py3-none-any.whl.
File metadata
- Download URL: tabqa-0.1.1-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dd82f3a6c38ec0ea04ae861f49ec58bf7e32ef5d07837034f49cb16e7eae3747
|
|
| MD5 |
c1a5bdb01217eaa84ae46a04bcc06c10
|
|
| BLAKE2b-256 |
67439c1f2a9e21fcb17dde61a92faed4941310658b164fbdc589002024ad87bb
|