No able to read 2d array column from RDS using py-data-api
basavaraj31 opened this issue · 0 comments
Describe the bug
Not able to get 2d array column values from RDS using py-data-api
To Reproduce
step 1: create the table in RDS aurora,
CREATE TABLE person(
pkey int,
col1 text [],
col2 text[][]
);
INSERT INTO person( pkey, col1,col2) VALUES( 1, '{'abc','def','xyz' }','{ {'a','b','c'}, {'d','e','f'} }' );
INSERT INTO person( pkey, col1,col2) VALUES( 2, '{'abc','def','xyz' }','{ {'a','b','c'}, {'d','e','f'} }' );
INSERT INTO person( pkey, col1,col2) VALUES( 3, '{'abc','def','xyz' }','{ {'a','b','c'}, {'d','e','f'} }' );
Step 2: try to query the table using py-data-api from aws lambda
query : select pkey, col1, col2 from person;
Step 3: below is the error i am getting
2023-01-23T19:07:06.994+05:30 executing the query
2023-01-23T19:07:07.216+05:30 ERROR : 'arrayValue'
2023-01-23T19:07:07.217+05:30 Traceback (most recent call last):
2023-01-23T19:07:07.217+05:30 File "/var/task/task_report_analysis.py", line 41, in handler
2023-01-23T19:07:07.217+05:30 results = get_data_from_rds(query_util.query, db_handler)
2023-01-23T19:07:07.217+05:30 File "/var/task/task_report_analysis.py", line 79, in get_data_from_rds
2023-01-23T19:07:07.217+05:30 result = db_handler.execute(query)
2023-01-23T19:07:07.217+05:30 File "/opt/python/lib/python3.8/site-packages/pydataapi/pydataapi.py", line 492, in execute
2023-01-23T19:07:07.217+05:30 return Result(response)
2023-01-23T19:07:07.217+05:30 File "/opt/python/lib/python3.8/site-packages/pydataapi/pydataapi.py", line 253, in init
2023-01-23T19:07:07.217+05:30 self._rows = [
2023-01-23T19:07:07.217+05:30 File "/opt/python/lib/python3.8/site-packages/pydataapi/pydataapi.py", line 254, in
2023-01-23T19:07:07.217+05:30 [_get_value_from_row(column) for column in row]
2023-01-23T19:07:07.217+05:30 File "/opt/python/lib/python3.8/site-packages/pydataapi/pydataapi.py", line 254, in
2023-01-23T19:07:07.217+05:30 [_get_value_from_row(column) for column in row]
2023-01-23T19:07:07.217+05:30 File "/opt/python/lib/python3.8/site-packages/pydataapi/pydataapi.py", line 141, in _get_value_from_row
2023-01-23T19:07:07.217+05:30 return [
2023-01-23T19:07:07.217+05:30 File "/opt/python/lib/python3.8/site-packages/pydataapi/pydataapi.py", line 142, in
2023-01-23T19:07:07.217+05:30 tuple(nested_value[ARRAY_VALUE].values())[0] # type: ignore