From b01425c21a9f6185e0e2c8c63905517dddb7704e Mon Sep 17 00:00:00 2001 From: Dana Ford Date: Wed, 22 Mar 2023 19:45:49 -0700 Subject: [PATCH 1/2] fix: incorrect scope with missing self --- IfxAlchemy/IfxPy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IfxAlchemy/IfxPy.py b/IfxAlchemy/IfxPy.py index 6c0d9ec..f8cc797 100644 --- a/IfxAlchemy/IfxPy.py +++ b/IfxAlchemy/IfxPy.py @@ -128,7 +128,7 @@ def do_execute(self, cursor, statement, parameters, context=None): _isolation_levels_returned = { value : key for key, value in _isolation_levels_cli.items()} def _get_cli_isolation_levels(self, level): - return _isolation_levels_cli[level] + return self._isolation_levels_cli[level] def set_isolation_level(self, connection, level): if level is None: @@ -143,7 +143,7 @@ def set_isolation_level(self, connection, level): "Valid isolation levels for %s are %s" % (level, self.name, ", ".join(self._isolation_lookup)) ) - attrib = {SQL_ATTR_TXN_ISOLATION:_get_cli_isolation_levels(self,level)} + attrib = {SQL_ATTR_TXN_ISOLATION: self._get_cli_isolation_levels(level)} res = connection.set_option(attrib) def reset_isolation_level(self, connection): From f842c93578e5f8418c71342cc87b31fb75345c65 Mon Sep 17 00:00:00 2001 From: Dana Ford Date: Thu, 23 Mar 2023 06:45:17 -0700 Subject: [PATCH 2/2] fix: syntax warning with py3.8, identity vs equality check --- IfxAlchemy/base.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IfxAlchemy/base.py b/IfxAlchemy/base.py index 57f3390..12b3192 100644 --- a/IfxAlchemy/base.py +++ b/IfxAlchemy/base.py @@ -400,9 +400,9 @@ def visit_select(self, select, **kwargs): sql = '%s, ( ROW_NUMBER() OVER() ) AS "%s" FROM ( %s ) AS M' % ( sql_sel, __rownum, sql_pri ) sql = '%s FROM ( %s ) Z WHERE' % ( sql_sel, sql ) - if offset is not 0: + if offset != 0: sql = '%s "%s" > %d' % ( sql, __rownum, offset ) - if offset is not 0 and limit is not None: + if offset != 0 and limit is not None: sql = '%s AND ' % ( sql ) if limit is not None: sql = '%s "%s" <= %d' % ( sql, __rownum, offset + limit )