Question
· Jun 17, 2023

how can i connect python application to IRIS database.

I want to connect IRIS system as it has all the database tables. on top of that I am creating a REST API in python. How can I connect to IRIS DB. here is my example code for connection

def connect():

connection_string = "localhost:1972/USER"

username = "_SYSTEM"

password = "SYS"

conn = iris.connect(connection_string, username, password)

after this connection is created but how can I get tables data. Please let me know more about how we can integrate IRIS database into a python REST API.

Product version: IRIS 2023.1
Discussion (1)1
Log in or sign up to continue

You did not mention, what package you would like to use in Python to make REST. 

  • if it's FastAPI, with this package you can use SQLAlchemy and sqlalchemy-iris 
  • Django, with this framework, then just use django-iris

In any case, I would recommend looking into SQLAlchemy, and its API, which has many features, of course including the way to list tables, as well as list columns in tables, and lots of other features.

If you are going to use some other package for making REST API, and this library does not support SQLAlchemy, let me know, I'll have a look, and may implement IRIS for this library too.