This project aims to implement text-to-SQL technique through Python, LangChain, and Streamlit. It allows users to input natural language questions and receive corresponding SQL queries and results.
- Docker
- Docker Compose
Warning: This project was entirely built and tested inside Docker. Running it locally without Docker may lead to unexpected issues or errors. The system may not work correctly if you try to run it outside of the Docker environment.
- Create a
.env
file from.dev.env
:
cp .dev.env .env
- Edit the
.env
file and fill in the required values:
OPENAI_API_KEY=""
DB_HOST=""
DB_USER=""
DB_PASSWORD=""
DB_NAME=""
- Build and run the project using Make:
make run
- This command will build the Docker image (if needed) and start the Streamlit app.
- The server will be running at:
make build
: Build the Docker imagesmake test
: Run tests in Dockermake clean
: Remove Python cache filesmake docker-clean
: Remove Docker containers, networks, and volumesmake help
: Display all available make commands
This project includes a suite of unit tests to ensure the reliability and correctness of the code. To run the tests, use the following command:
make test
This command will build the Docker image (if needed) and run the tests inside a Docker container.
The tests are executed using pytest with verbose output for detailed information about each test case.
Here's an example of what the test output looks like: