Skip to content

Commit 562a617

Browse files
kislyukUbuntu
authored andcommitted
Fix bug in param prep hint application
1 parent c825c6c commit 562a617

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

aurora_data_api/__init__.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,18 +152,19 @@ def prepare_param(self, param_name, param_value):
152152
if param_value is None:
153153
return dict(name=param_name, value=dict(isNull=True))
154154
param_data_api_type = self._data_api_type_map.get(type(param_value), "stringValue")
155+
param = dict(name=param_name, value={param_data_api_type: param_value})
155156
if param_data_api_type == "stringValue" and not isinstance(param_value, str):
156-
param_value = str(param_value)
157+
param["value"][param_data_api_type] = str(param_value)
158+
if type(param_value) in self._data_api_type_hint_map:
159+
param["typeHint"] = self._data_api_type_hint_map[type(param_value)]
160+
return param
161+
157162
# if param_data_api_type == "arrayValue" and len(param_value) > 0:
158163
# return {
159164
# param_data_api_type: {
160165
# self._data_api_type_map.get(type(param_value[0]), "stringValue") + "s": param_value
161166
# }
162167
# }
163-
param = dict(name=param_name, value={param_data_api_type: param_value})
164-
if type(param_value) in self._data_api_type_hint_map:
165-
param["typeHint"] = self._data_api_type_hint_map[type(param_value)]
166-
return param
167168

168169
def _set_description(self, column_metadata):
169170
# see https://www.postgresql.org/docs/9.5/datatype.html

0 commit comments

Comments
 (0)