Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

sqlalchemy-iris

An InterSystems IRIS dialect for SQLAlchemy.

Pre-requisites

This dialect requires SQLAlchemy, InterSystems DB-API driver, and iris-embedded-python-wrapper. They are specified as requirements so pip will install them if they are not already in place. To install, just:

pip install sqlalchemy-iris

Or to use InterSystems official driver support

pip install sqlalchemy-iris[intersystems]

Usage

In your Python app, you can connect to the database via:

from sqlalchemy import create_engine
engine = create_engine("iris://_SYSTEM:SYS@localhost:1972/USER")

To use with Python Embedded mode through iris-embedded-python-wrapper, when run next to IRIS

from sqlalchemy import create_engine
engine = create_engine("iris+emb://USER")

The legacy path form iris+emb:///USER is also supported.

To use with InterSystems official driver, does not work in Python Embedded mode

from sqlalchemy import create_engine
engine = create_engine("iris+intersystems://_SYSTEM:SYS@localhost:1972/USER")

IRIS Cloud SQL requires SSLContext

url = engine.URL.create(
    drivername="iris",
    host=host,
    port=443,
    username='SQLAdmin',
    password=password,
    database='USER',
)

sslcontext = ssl.create_default_context(cafile="certificateSQLaaS.pem")

engine = create_engine(url, connect_args={"sslcontext": sslcontext})

InterSystems IRIS

You can run your instance of InterSystems IRIS Community Edition with Docker

docker run -d --name iris \
 -p 1972:1972 \
 -p 52773:52773 \
 -e IRIS_USERNAME=_SYSTEM \
 -e IRIS_PASSWORD=SYS \
 intersystemsdc/iris-community:preview

Examples

IRISVector

from sqlalchemy import Column, MetaData, Table, select
from sqlalchemy.sql.sqltypes import Integer, UUID
from sqlalchemy_iris import IRISVector
from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase
import uuid

DATABASE_URL = "iris://_SYSTEM:SYS@localhost:1972/USER"
engine = create_engine(DATABASE_URL, echo=False)

# Create a table metadata
metadata = MetaData()


def main():
    demo_table = Table(
        "demo_table",
        metadata,
        Column("id", Integer, primary_key=True, autoincrement=True),
        Column("uuid", UUID),
        Column("embedding", IRISVector(item_type=float, max_items=3)),
    )

    demo_table.drop(engine, checkfirst=True)
    demo_table.create(engine, checkfirst=True)
    with engine.connect() as conn:
        conn.execute(
            demo_table.insert(),
            [
                {"uuid": uuid.uuid4(), "embedding": [1, 2, 3]},
                {"uuid": uuid.uuid4(), "embedding": [2, 3, 4]},
            ],
        )
        conn.commit()
        result = conn.execute(
            demo_table.select()
        ).fetchall()
        print("result", result)


main()

Port 1972 is used for binary communication (this driver, xDBC and so on), and 52773 is for web (Management Portal, IRIS based web-applications and API's).

The System Management Portal is available by URL: http://localhost:52773/csp/sys/UtilHome.csp

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sqlalchemy_iris-0.20.1b2.tar.gz (41.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlalchemy_iris-0.20.1b2-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file sqlalchemy_iris-0.20.1b2.tar.gz.

File metadata

  • Download URL: sqlalchemy_iris-0.20.1b2.tar.gz
  • Upload date:
  • Size: 41.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sqlalchemy_iris-0.20.1b2.tar.gz
Algorithm Hash digest
SHA256 2833eb21473778ebe989a70ecc0299e1c351cb60b798a8d2482b1db0ee9d4567
MD5 94bdb02989c515ab8b12cd4535caed22
BLAKE2b-256 8e14237d22009e763e250cc544110ef751fda4240b1283165ea3752257116a9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_iris-0.20.1b2.tar.gz:

Publisher: python-publish.yml on caretdev/sqlalchemy-iris

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sqlalchemy_iris-0.20.1b2-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlalchemy_iris-0.20.1b2-py3-none-any.whl
Algorithm Hash digest
SHA256 45abb8fc4f4e85b5d88971f2850cf612029cbb4f6eba3aba33c8aa0fa8d3ab12
MD5 f9af2b2f3860a5b458f983a99412f797
BLAKE2b-256 46cb14e6ed993710256cf4162074df1b152b4f08a534b9aa86376d2156985a34

See more details on using hashes here.

Provenance

The following attestation bundles were made for sqlalchemy_iris-0.20.1b2-py3-none-any.whl:

Publisher: python-publish.yml on caretdev/sqlalchemy-iris

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.20.1b2 This release

2 files

0.20.0

2 files

0.19.1

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.1

2 files

0.17.0

2 files

0.16.1

2 files

0.16.0

2 files

0.15.5

2 files

0.15.4

2 files

0.15.3

2 files

0.15.2

2 files

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.3

2 files

0.13.2

2 files

0.13.1

2 files

0.13.0

2 files

0.12.1

2 files

0.12.0

2 files

0.11.0

2 files

0.10.5

2 files

0.10.4

2 files

0.10.3

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page