-
Notifications
You must be signed in to change notification settings - Fork 228
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
2D Array throws an error on GET #288
Comments
I think the issue is here: https://github.com/graphql-python/graphene-sqlalchemy/blob/master/graphene_sqlalchemy/converter.py#L241 The SQLAlchemy dimensions property should be checked: https://docs-sqlalchemy.readthedocs.io/ko/latest/core/type_basics.html#sqlalchemy.types.ARRAY.params.dimensions I would be happy to contribute this fix. Would you accept a patch for this? Thank you for your time and attention to this issue. |
Facing this as well. Merging into the main repo would be really helpful! |
@wkevwang This project is not maintained. I recommend using PostGraphile instead. |
Seems like its still an issue today. I used @jbeard4 patch and it works as expected. from sqlalchemy import types
from graphene import List
from graphene_sqlalchemy import converter
from sqlalchemy.dialects import postgresql
def init_array_list_recursive(inner_type, n):
return inner_type if n == 0 else List(init_array_list_recursive(inner_type, n-1))
@converter.convert_sqlalchemy_type.register(types.ARRAY)
@converter.convert_sqlalchemy_type.register(postgresql.ARRAY)
def convert_array_to_list(_type, column, registry=None):
inner_type = converter.convert_sqlalchemy_type(column.type.item_type, column)
return List(init_array_list_recursive(inner_type, (column.type.dimensions or 1) - 1))
converter.convert_array_to_list = convert_array_to_list |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related topics referencing this issue. |
Hello,
I have found that a column declaration like this:
Which contains a 2D array (as is supported in, for example, Postgresql), yields an error on get:
Are 2D arrays supported by graphene-sqlalchemy?
Thank you for your help with this.
The text was updated successfully, but these errors were encountered: