Aim of this project is to build a system capable to connect to any database and draw a figure based on the prompt.
- Install necesarry frameworks:
pip install -r requirements.txt
, - Go to app directory:
cd app
, - Run streamlit app:
streamlit run app.py
, - Create
.env
file and add there YourOPENAI_API_KEY
.
At the very beginning You'll see layout like below:
Reason of this is that You haven't added any database connection yet. To do this, go to Add new database tab. After that You'll see a form which You have to complete with appropriate data. General shape of form may be diffrent for each DBMS. It is caused of the diffrent ways to connect with this systems. After clicking button Add database app will create new directory in existing/
, then creates .env
file which contains all db connection details.
Form to add Oracle DB connection looks like below:
To propertly run configuration You have to add sqlplus to global PATH variables. Form allows You to connect with database by SID and Service Name.
First of all, You have to download ODBC Driver. Except that you have to download extension for SQL Server:
Install-Module -Name SqlServer`
Form for both DBMSs are the same. If You're using PostgreSQL add pg_dump
to global PATH variables. Otherwise add mysqkdump
to PATH global variables.
To show an example I'll use dvdrental sample database. Making connection showed below:
Go back to Chat tab and refresh the page. Now You should see available connections:
Now in text field You have to provide sentence what plot You want to see. In my example I'm gonna plot a pie chart of amount of films in each category. Results showed below: