IRIS SQLCloud connect by pyodbc with UI
I am sorry to let you know that I am new to Python (and also IRIS) ...
That's is the reason I started this mini project
- to connect to IRIS by pyodbc
- to do the basic query by UI
- to learn how to write python (I am sorry I am not a good programmer)
The interesting thing is I found it is quite easy to write some simple UI by using the tkinter library of python
- Deploy a table on the IRIS SQLCloud
- Run a Create table query
- Upload a .csv file
- Query the table by the UI wirtten by Python
- Select
- Insert
- Update
- Export the selected rows to .csv file
In my code, I have written 3 .py file
- Step1_pyobc_configUI
- Step2_pyobc_uploadcsv
- Step3_pyobc_selectpatient
and there is one config file for storing the pyodbc connection configuration
- connetconf
and there is a csv file storing a set for sample patient data
- PatientData
- Python 3.x should be installed (recommended python 3.4-3.7, if you would like to use the irienative library. I found the wheel file for 3.8-3.9 also, but 3.10... sorry may need to wait.)
- The following libraries are used, please include them by (py -m pip install )
- import tkinter
- import pyodbc
- import ast
I am using Python 3.9, btw...
To make it simple, I devied my code into three parts
- Input the connection information and click the save button to save the configuration
- You may click the Test Connection button to test the connection
- Input the Name of the table you are going to create (recommend "Patient" if you don't want to modify the code in Step 3)
- Click the Open button to import a .csv file
- A Create table script will be generated, you may modify it before clicking the Create Table button to create
- Click the Create Table button to create a table
- Click the Upload Data button to upload data
- Input a Name e.g "T", Click Search
- Click on the search result to get the detail
- You may modify, insert (if no Patient ID is provided), and export the search result to .csv