Skip to content

Commit

Permalink
fix for embedded version
Browse files Browse the repository at this point in the history
  • Loading branch information
daimor committed Feb 16, 2024
1 parent 7b51412 commit 7004975
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
7 changes: 5 additions & 2 deletions sqlalchemy_iris/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,8 +899,11 @@ def on_connect(conn):
if super_ is not None:
super_(conn)

iris = IRISNative.createIRIS(conn)
self.supports_vectors = iris.classMethodBoolean("%SYSTEM.License", "GetFeature", 28)
if self.embedded:
self.supports_vectors = conn.iris.cls("%SYSTEM.License").GetFeature(28) == 1
else:
iris = IRISNative.createIRIS(conn)
self.supports_vectors = iris.classMethodBoolean("%SYSTEM.License", "GetFeature", 28)
if self.supports_vectors:
with conn.cursor() as cursor:
# Distance or similarity
Expand Down
12 changes: 9 additions & 3 deletions sqlalchemy_iris/embedded.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,25 @@ class IRISDialect_emb(IRISDialect):
driver = "emb"

embedded = True

supports_statement_cache = True

def _get_option(self, connection, option):
return connection.iris.cls('%SYSTEM.SQL.Util').GetOption(option)
return connection.iris.cls("%SYSTEM.SQL.Util").GetOption(option)

def _set_option(self, connection, option, value):
return connection.iris.cls('%SYSTEM.SQL.Util').SetOption(option)
return connection.iris.cls("%SYSTEM.SQL.Util").SetOption(option)

@classmethod
def import_dbapi(cls):
import intersystems_iris.dbapi._DBAPI as dbapi

return dbapi

def _get_server_version_info(self, connection):
server_version = connection._dbapi_connection.iris.system.Version.GetNumber()
server_version = server_version.split(".")
return tuple([int("".join(filter(str.isdigit, v))) for v in server_version])


dialect = IRISDialect_emb

0 comments on commit 7004975

Please sign in to comment.