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

Add support for ARRAY type #3

Closed
wants to merge 2 commits into from
Closed

Add support for ARRAY type #3

wants to merge 2 commits into from

Conversation

mmat11
Copy link

@mmat11 mmat11 commented Jul 2, 2020

This PR adds support for ARRAY type

PS. was the import ordering incorrect? I just ran isort -rc .

@codecov-commenter
Copy link

codecov-commenter commented Jul 2, 2020

Codecov Report

Merging #3 into master will increase coverage by 0.20%.
The diff coverage is 83.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master       #3      +/-   ##
==========================================
+ Coverage   27.25%   27.45%   +0.20%     
==========================================
  Files          11       11              
  Lines         444      448       +4     
==========================================
+ Hits          121      123       +2     
- Misses        323      325       +2     
Impacted Files Coverage Δ
src/graphql_sqlalchemy/dialects/pg/inputs.py 0.00% <0.00%> (ø)
src/graphql_sqlalchemy/objects.py 37.50% <75.00%> (+1.78%) ⬆️
src/graphql_sqlalchemy/args.py 48.27% <100.00%> (ø)
src/graphql_sqlalchemy/helpers.py 70.00% <100.00%> (ø)
src/graphql_sqlalchemy/inputs.py 20.23% <100.00%> (ø)
src/graphql_sqlalchemy/names.py 52.17% <100.00%> (ø)
src/graphql_sqlalchemy/resolvers.py 14.55% <100.00%> (ø)
src/graphql_sqlalchemy/scalars.py 53.33% <100.00%> (ø)
src/graphql_sqlalchemy/schema.py 27.50% <100.00%> (ø)
src/graphql_sqlalchemy/types.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 01a7508...a962141. Read the comment docs.

Copy link
Owner

@gzzo gzzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@@ -25,6 +27,8 @@ def get_fields() -> GraphQLFieldMap:
graphql_type: GraphQLOutputType = get_graphql_type_from_column(column)
if not column.nullable:
graphql_type = GraphQLNonNull(graphql_type)
if isinstance(column.type, (ARRAY, PGARRAY)):
graphql_type = GraphQLList(graphql_type)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make more sense to include this in scalars/get_graphql_type_from_column directly?

It would have the nice effect of changing the return type of that function to GraphQLOutputType

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already tried doing that (was my first attempt) but somehow that function is probably called somewhere else too (I printed the column type and graphql type assigned and when I changed that function it was printed way more than here) and it ended up not working

@gzzo
Copy link
Owner

gzzo commented Jul 3, 2020

Replacing this with #4

@gzzo gzzo closed this Jul 3, 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

Successfully merging this pull request may close these issues.

None yet

3 participants