Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PgArray #62

Closed
sdurban opened this issue May 15, 2020 · 2 comments
Closed

Support PgArray #62

sdurban opened this issue May 15, 2020 · 2 comments

Comments

@sdurban
Copy link
Contributor

sdurban commented May 15, 2020

Describe the bug
When you try to get a postgresql array column like:

SELECT string_to_array('1, 2, 3, 4', ',');

App will crash with the error:

Exception: unsupported type <class 'jpype._jclass.org.postgresql.jdbc.PgArray'>: {1," 2"," 3"," 4"}

To Reproduce
In postgresql make a query like (engine configured as PostgreSQLJDBC).

POST http://127.0.0.1:8080/Execute
User-Agent: aws-sdk-nodejs/2.647.0 linux/v12.16.1 promise
Content-Type: application/json
{
"secretArn": "arn:aws:secretsmanager:us-east-1:123456789012:secret:dummy",
"resourceArn": "arn:aws:rds:us-east-1:123456789012:cluster:dummy",
"sql": "SELECT string_to_array('1, 2, 3, 4', ',')",
"database": "test"
}

Expected behavior
App needs to return a string value {1, 2, 3, 4} like in this example from a real aurora data api:
image

In definition is a stringvalue.
image

About PostgresSQL Engine (No JDBC)
Making the query with python native connector returns a list:

unsupported type <class 'list'>: ['1', ' 2', ' 3', ' 4']

I think is kind of dangerous make a conversion from list to a schema like {1, 2, 3, 4}. Maybe it needs a refactor like conversions-per-type (JVM(PSQL/MYSQL) an non-JVM classes (PSQL and MYSQL separated)?

@koxudaxi
Copy link
Owner

@sdurban

I think is kind of dangerous make a conversion from list to a schema like {1, 2, 3, 4}. Maybe it needs a refactor like conversions-per-type (JVM(PSQL/MYSQL) an non-JVM classes (PSQL and MYSQL separated)?

I agreed.
I will create issue for this refactoring.
But, I may not able to get time refactoring the logic on another project 😅

@sdurban
Copy link
Contributor Author

sdurban commented May 15, 2020

Thanks for the fast accept ;).

@sdurban sdurban closed this as completed May 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants