Skip to content

ecelg/IRIS-SQLCloud-connect-by-pyodbc-with-UI

Repository files navigation

IRIS-SQLCloud-connect-by-pyodbc-with-UI

IRIS SQLCloud connect by pyodbc with UI

Hello everyone (maybe only me is reading),

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

In this mini project, it contained two parts

  • 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

About my code

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

Before running the code

  1. 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.)
  2. 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...

Running the code

To make it simple, I devied my code into three parts

Step0. Deploy a cloud and get the connection information

step0deployacloud

Step1. Connection setting and testing

  1. Input the connection information and click the save button to save the configuration
  2. You may click the Test Connection button to test the connection

step1py

Step2. Table creating and sample data uploading

  1. 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)
  2. Click the Open button to import a .csv file
  3. A Create table script will be generated, you may modify it before clicking the Create Table button to create
  4. Click the Create Table button to create a table
  5. Click the Upload Data button to upload data

step2py

Step3. Data query, insert, modify and export

  1. Input a Name e.g "T", Click Search
  2. Click on the search result to get the detail
  3. You may modify, insert (if no Patient ID is provided), and export the search result to .csv

step3py

Play around and enjoy!

About

IRIS SQLCloud connect by pyodbc with UI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages