Bug with json columns
mkieblesz opened this issue · 1 comments
mkieblesz commented
After 0.2.7 version, aurora-data-api is loading json string into python dictionary and then sqlalchemy does the same thing which results in following error.
Traceback (most recent call last):
File "/var/task/handler.py", line 106, in handler
return app.resolve(event, context)
File "/opt/python/aws_lambda_powertools/event_handler/api_gateway.py", line 502, in resolve
return self._resolve().build(self.current_event, self._cors)
File "/opt/python/aws_lambda_powertools/event_handler/api_gateway.py", line 561, in _resolve
return self._call_route(route, match_results.groupdict()) # pass fn args
File "/opt/python/aws_lambda_powertools/event_handler/api_gateway.py", line 615, in _call_route
return ResponseBuilder(self._to_response(route.func(**args)), route)
File "/var/task/handler.py", line 102, in handle_rutter
return JsonResponse({'integration_connection_id': str(integration_connection.id)})
File "/var/task/sqlalchemy/orm/attributes.py", line 481, in __get__
return self.impl.get(state, dict_)
File "/var/task/sqlalchemy/orm/attributes.py", line 941, in get
value = self._fire_loader_callables(state, key, passive)
File "/var/task/sqlalchemy/orm/attributes.py", line 972, in _fire_loader_callables
return state._load_expired(state, passive)
File "/var/task/sqlalchemy/orm/state.py", line 710, in _load_expired
self.manager.expired_attribute_loader(self, toload, passive)
File "/var/task/sqlalchemy/orm/loading.py", line 1451, in load_scalar_attributes
result = load_on_ident(
File "/var/task/sqlalchemy/orm/loading.py", line 407, in load_on_ident
return load_on_pk_identity(
File "/var/task/sqlalchemy/orm/loading.py", line 541, in load_on_pk_identity
return result.one()
File "/var/task/sqlalchemy/engine/result.py", line 1407, in one
return self._only_one_row(
File "/var/task/sqlalchemy/engine/result.py", line 558, in _only_one_row
row = onerow(hard_close=True)
File "/var/task/sqlalchemy/engine/result.py", line 1271, in _fetchone_impl
return self._real_result._fetchone_impl(hard_close=hard_close)
File "/var/task/sqlalchemy/engine/result.py", line 1674, in _fetchone_impl
row = next(self.iterator, _NO_ROW)
File "/var/task/sqlalchemy/orm/loading.py", line 147, in chunks
fetch = cursor._raw_all_rows()
File "/var/task/sqlalchemy/engine/result.py", line 392, in _raw_all_rows
return [make_row(row) for row in rows]
File "/var/task/sqlalchemy/engine/result.py", line 392, in <listcomp>
return [make_row(row) for row in rows]
File "/var/task/sqlalchemy/sql/sqltypes.py", line 2656, in process
return json_deserializer(value)
File "/var/lang/lib/python3.9/json/__init__.py", line 339, in loads
raise TypeError(f'the JSON object must be str, bytes or bytearray, '
To fix this aurora-data-api will have to accept argument which won't do json loading in when it is used with sqlalchemy
kislyuk commented
Fixed in v0.3.3.