Skip to content

create_connect_args() sets "host" but connect() reads "hostname" — non-localhost connections silently fail #38

Description

@lgoodkin

IRISDialect_intersystems.create_connect_args() builds a kwargs dict with the key
"host":

opts["host"] = url.host

But IRISDialect_intersystems.connect() reads it back under a different key:

host = kwarg.get("hostname", "localhost")

Since "hostname" is never actually present in the dict create_connect_args()
built, host silently falls back to its default value, "localhost", regardless
of what host is specified in the connection URL. The username, password, port,
and namespace keys all match correctly between the two methods — only host/
hostname is mismatched.

Impact: any connection to a non-localhost IRIS server fails. This is easy to
miss because every example in the README uses localhost, which happens to
"work" by coincidence (it's the same value the buggy fallback produces).
Connecting to IRIS running in a separate Docker container, or any remote host,
fails with a misleading error that looks like an auth problem, not a
configuration bug:

RuntimeError: <COMMUNICATION LINK ERROR> Failed to connect to server;
Details: <COMMUNICATION ERROR> Invalid Message received; Details: Access Denied

To reproduce:

from sqlalchemy import create_engine
engine = create_engine("iris+intersystems://user:pass@some-remote-host:1972/USER")
conn = engine.connect()  # fails, silently tries "localhost" instead

Workaround: explicitly pass the correctly-named key via connect_args:

engine = create_engine(
    "iris+intersystems://user:pass@some-remote-host:1972/USER",
    connect_args={"hostname": "some-remote-host"},
)

Suggested fix: in create_connect_args(), either rename opts["host"] to
opts["hostname"], or in connect(), change kwarg.get("hostname", "localhost")
to kwarg.get("host", "localhost") — whichever matches the intended contract with
dbapi.py's connect(), which passes these straight through to
iris.connect(*args, **kwargs).

Environment:

  • sqlalchemy-iris 0.20.0
  • intersystems-irispython 5.3.2
  • IRIS for UNIX 2026.2 (Build 221U)
  • Python 3.10, SQLAlchemy 1.4
  • Reproduced with both iris:// and iris+intersystems:// schemes (both route
    through the same sqlalchemy_iris/intersystems/ code path in this version)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions