InterSystems IRIS for SQLAlchemy
Project description
sqlalchemy-iris
An InterSystems IRIS dialect for SQLAlchemy.
Pre-requisites
This dialect requires SQLAlchemy, InterSystems DB-API driver. 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, when run next to IRIS
from sqlalchemy import create_engine
engine = create_engine("iris+emb:///USER")
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sqlalchemy_iris-0.18.1.tar.gz.
File metadata
- Download URL: sqlalchemy_iris-0.18.1.tar.gz
- Upload date:
- Size: 132.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
859cf76e8851501c1787ac11015f7d281f093fd68fb388a770ee96aa7a525e53
|
|
| MD5 |
51284fc1618e573c67d82b0d0b49aeb3
|
|
| BLAKE2b-256 |
a6d84c75882acabaff6ef15675238a0827b507083ea49b1207b752e6fd537b07
|
Provenance
The following attestation bundles were made for sqlalchemy_iris-0.18.1.tar.gz:
Publisher:
python-publish.yml on caretdev/sqlalchemy-iris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlalchemy_iris-0.18.1.tar.gz -
Subject digest:
859cf76e8851501c1787ac11015f7d281f093fd68fb388a770ee96aa7a525e53 - Sigstore transparency entry: 660793698
- Sigstore integration time:
-
Permalink:
caretdev/sqlalchemy-iris@d88a071152da7d8842bade670c5985316a39f1c2 -
Branch / Tag:
refs/tags/v0.18.1 - Owner: https://github.com/caretdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d88a071152da7d8842bade670c5985316a39f1c2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sqlalchemy_iris-0.18.1-py3-none-any.whl.
File metadata
- Download URL: sqlalchemy_iris-0.18.1-py3-none-any.whl
- Upload date:
- Size: 151.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c6adae4df3a3106352e27ead8949a6f54f6227111022845b9fcbad4cb735f40
|
|
| MD5 |
03bd626d48fda07b7ca2e37dc9ff9283
|
|
| BLAKE2b-256 |
a4f3a70f99308e92744a301f7d98b1790cad3ab4768fe5ef2b310ce57fa42b47
|
Provenance
The following attestation bundles were made for sqlalchemy_iris-0.18.1-py3-none-any.whl:
Publisher:
python-publish.yml on caretdev/sqlalchemy-iris
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sqlalchemy_iris-0.18.1-py3-none-any.whl -
Subject digest:
7c6adae4df3a3106352e27ead8949a6f54f6227111022845b9fcbad4cb735f40 - Sigstore transparency entry: 660793699
- Sigstore integration time:
-
Permalink:
caretdev/sqlalchemy-iris@d88a071152da7d8842bade670c5985316a39f1c2 -
Branch / Tag:
refs/tags/v0.18.1 - Owner: https://github.com/caretdev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d88a071152da7d8842bade670c5985316a39f1c2 -
Trigger Event:
release
-
Statement type: