Skip to content

Bug "type object 'Employee' has no attribute 'sort_argument'" #216

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

Closed
royhananwar opened this issue May 22, 2019 · 6 comments
Closed

Bug "type object 'Employee' has no attribute 'sort_argument'" #216

royhananwar opened this issue May 22, 2019 · 6 comments

Comments

@royhananwar
Copy link

I just clone this repo and try flask example
but when I try to run it without have any changing code
I got an error like this

Traceback (most recent call last): File "./app.py", line 5, in <module> from schema import schema File "/home/examples/flask_sqlalchemy/schema.py", line 28, in <module> class Query(graphene.ObjectType): File "/home/examples/flask_sqlalchemy/schema.py", line 32, in Query Employee, sort=Employee.sort_argument()) AttributeError: type object 'Employee' has no attribute 'sort_argument'

What should I do?

Thank you!

@Cito
Copy link
Member

Cito commented May 23, 2019

Are you sure you have the version from the cloned repo installed when running the app, not an older version?

@fatore
Copy link

fatore commented May 23, 2019

I got the same here while following the steps from https://github.com/graphql-python/graphene-sqlalchemy/tree/master/examples/flask_sqlalchemy.

I assumed the proper versions were defined in the requirements.txt file.

@Cito
Copy link
Member

Cito commented May 23, 2019

That requirements.txt file installs graphene-sqlalchemy from PyPI which is not compatible with the current development version. I think the requirements.txt file should be replaced with this:

-e ../../
Flask-GraphQL

That will install the currently checked out version. Graphene and SQLAlchemy will be automatically installed as dependencies with matching versions. Only Flask-GraphQL needs to be installed explicitly and needs to be added in requirements.txt.

Can you remove the virtualenv directory env and try again with that requirements.txt file?

@jnak
Copy link
Collaborator

jnak commented May 23, 2019

Good point. There you go #218

@royhananwar
Copy link
Author

That requirements.txt file installs graphene-sqlalchemy from PyPI which is not compatible with the current development version. I think the requirements.txt file should be replaced with this:

-e ../../
Flask-GraphQL

That will install the currently checked out version. Graphene and SQLAlchemy will be automatically installed as dependencies with matching versions. Only Flask-GraphQL needs to be installed explicitly and needs to be added in requirements.txt.

Can you remove the virtualenv directory env and try again with that requirements.txt file?

Yes, you are right. I need to use the old requirements.txt
Thank you!
it worked like charms!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants