A Python-based SQL bot for Slack. Users send requests, and the bot analyzes the request, creates, and executes an appropriate SQL query using a provided schema to get the desired result.
- Process SQL queries from Slack messages
- Execute queries against Oracle and Vertica databases
- Return query results as files in Slack channels
- Docker support for easy deployment
- Docker and Docker Compose
- Slack App configured with proper permissions
- Database access credentials
-
Clone this repository:
git clone https://github.com/yourusername/SQLoslav.git cd SQLoslav
-
Create an
.env
file with your environment variables (see.env.example
):cp .env.example .env # Edit .env with your settings
-
Build and start the Docker container:
docker-compose up -d
-
The service will be available on port 5000.
- Create a Slack App in the Slack API Console
- Add the following Bot Token Scopes:
chat:write
files:read
files:write
incoming-webhook
- Enable Event Subscriptions:
- Set the Request URL to your server's URL:
https://your-server.com/slack/events
- Subscribe to the following events:
message.im
,file_shared
- Set the Request URL to your server's URL:
- Install the app to your workspace
- Copy the Bot User OAuth Token to your
.env
file
When your application is deployed, you can access it through your server's domain at:
https://your-server.com/
A simple health check is available at the root URL.
To run the application locally without Docker:
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python main.py
- If you have issues with the Slack integration, check the logs for detailed error messages
- Ensure your server's URL is publicly accessible
- Verify that all database connection credentials are correct