The query execution is based on PostgreSQL's python library -- PyGreSQL, it needs to be installed on the server first.
- On terminal, open bash
$sudo bash
- Adding system variables
$export CFLAGS=-Qunused-arguments
$export CPPFLAGS=-Qunused-arguments
- Install
$pip install PyGreSQL
go into PostgreSQL-5.0 folder, type the folowing commands
python setup.py build
python setup.py install
- Clone this repo
- Config your database name, host, port, user name, and password in
connection.py
db = DB(dbname='',host='',port= ,user='',passwd='')
- Deploy this to server(For example, Heroku).
- Add this integration to your Slack. Specify your url in the Slack integration URL.
- All set!
- create table:
/sql create table users(id primary key, name varchar, email varchar, age int)
- Insert data:
/sql insert into users values(1, 'Seth Wang')
- selection:
/sql select users.name from users where id=1
- deletion
/sql delete from users where id=2