Skip to content

Commit 49b68bc

Browse files
committed
fix for older version of sqlalchemy
1 parent 6c24ed7 commit 49b68bc

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

.github/workflows/python-publish.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
image:
25-
- containers.intersystems.com/intersystems/iris-community:latest-cd
26-
- containers.intersystems.com/intersystems/iris-community:latest-preview
25+
- latest-cd
26+
- latest-preview
2727
engine:
2828
- old
2929
- new
@@ -33,7 +33,7 @@ jobs:
3333
runs-on: ubuntu-latest
3434
services:
3535
iris:
36-
image: ${{ matrix.image }}
36+
image: containers.intersystems.com/intersystems/iris-community:${{ matrix.image }}
3737
ports:
3838
- 1972:1972
3939
options: >-

sqlalchemy_iris/types.py

+32
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ def process(value):
5656

5757
return process
5858

59+
def literal_processor(self, dialect):
60+
def process(value):
61+
if isinstance(value, datetime.date):
62+
return "'%s'" % value.strftime("%Y-%m-%d")
63+
return value
64+
65+
return process
66+
5967

6068
class IRISTimeStamp(sqltypes.DateTime):
6169
__visit_name__ = "TIMESTAMP"
@@ -84,6 +92,14 @@ def process(value):
8492

8593
return process
8694

95+
def literal_processor(self, dialect):
96+
def process(value):
97+
if isinstance(value, datetime.datetime):
98+
return "'%s'" % value.strftime("%Y-%m-%d %H:%M:%S.%f")
99+
return value
100+
101+
return process
102+
87103

88104
class IRISDateTime(sqltypes.DateTime):
89105
__visit_name__ = "DATETIME"
@@ -108,6 +124,14 @@ def process(value):
108124

109125
return process
110126

127+
def literal_processor(self, dialect):
128+
def process(value):
129+
if isinstance(value, datetime.datetime):
130+
return "'%s'" % value.strftime("%Y-%m-%d %H:%M:%S.%f")
131+
return value
132+
133+
return process
134+
111135

112136
class IRISTime(sqltypes.DateTime):
113137
__visit_name__ = "TIME"
@@ -140,6 +164,14 @@ def process(value):
140164

141165
return process
142166

167+
def literal_processor(self, dialect):
168+
def process(value):
169+
if isinstance(value, datetime.time):
170+
return "'%s'" % value.strftime("%H:%M:%S.%f")
171+
return value
172+
173+
return process
174+
143175

144176
if sqlalchemy_version.startswith("2."):
145177

0 commit comments

Comments
 (0)