Графен - SqlAlchemy - абстрактный атрибут - PullRequest
0 голосов
/ 14 сентября 2018

Я мигрирую, чтобы закрепить немного старое приложение на Python, не поддерживается .... Я сделал pip freeze, чтобы посмотреть, что будет запущено в производство.Я столкнулся с проблемой, которую мне трудно решить.У меня есть эта ошибка: поэтому мне интересно, если это не проблема, связанная с версией, которая не соблюдается.Проект работает на python 3.6.2.

У вас есть идеи, как я могу решить эту проблему?

трассировка стека

raphql_1  |   File "/usr/local/bin/gunicorn", line 11, in <module>
graphql_1  |     sys.exit(run())
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
graphql_1  |     WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 203, in run
graphql_1  |     super(Application, self).run()
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 72, in run
graphql_1  |     Arbiter(self).run()
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 60, in __init__
graphql_1  |     self.setup(app)
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/arbiter.py", line 120, in setup
graphql_1  |     self.app.wsgi()
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
graphql_1  |     self.callable = self.load()
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
graphql_1  |     return self.load_wsgiapp()
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
graphql_1  |     return util.import_app(self.app_uri)
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/gunicorn/util.py", line 352, in import_app
graphql_1  |     __import__(module)
graphql_1  |   File "/workspace/src/server/main.py", line 15, in <module>
graphql_1  |     from api import root
graphql_1  |   File "/workspace/src/api/root.py", line 6, in <module>
graphql_1  |     from api import mutation, query
graphql_1  |   File "/workspace/src/api/mutation.py", line 4, in <module>
graphql_1  |     from api.object_types import (availability, home, home_feature,
graphql_1  |   File "/workspace/src/api/object_types/availability.py", line 6, in <module>
graphql_1  |     from api.helpers.objecttype import QueryProvidingObjectType
graphql_1  |   File "/workspace/src/api/helpers/objecttype.py", line 49, in <module>
graphql_1  |     class QueryProvidingObjectType(SQLAlchemyObjectType):
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/graphene_sqlalchemy/types.py", line 85, in __new__
graphql_1  |     registry=None
graphql_1  |   File "/usr/local/lib/python3.6/site-packages/graphene/types/options.py", line 29, in __init__
graphql_1  |     ', '.join(sorted(meta_attrs.keys()))
graphql_1  | TypeError: Invalid attributes: abstract

require.txt

alembic==0.9.7
backports.csv==1.0.5
certifi==2017.11.5
chardet==3.0.4
cli-helpers==0.2.2
click==6.7
configobj==5.0.6
decorator==4.2.1
fin==2.1.8
flake8==3.4.1
Flask==0.12.2
Flask-Cors==3.0.3
Flask-GraphQL==1.4.1
Flask-SSLify==0.1.5
graphene==1.4.1
graphene-sqlalchemy==1.1.1
graphql-core==1.1
graphql-relay==0.4.5
graypy==0.2.14
gunicorn==19.7.1
httplib2==0.10.3
humanize==0.5.1
idna==2.6
ipython==6.2.1
ipython-genutils==0.2.0
iso8601==0.1.12
itsdangerous==0.24
jedi==0.11.1
Jinja2==2.9.6
Mako==1.0.7
MarkupSafe==1.0
mccabe==0.6.1
mock==2.0.0
oauth2client==4.1.2
parso==0.1.1
pbr==3.1.1
pexpect==4.3.1
pgcli==1.7.0
pgspecial==1.8.0
pickleshare==0.7.4
promise==2.1
prompt-toolkit==1.0.15
psycopg2==2.7.1
ptyprocess==0.5.2
py==1.4.34
pyasn1==0.4.2
pyasn1-modules==0.2.1
pycodestyle==2.3.1
pyflakes==1.5.0
Pygments==2.2.0
pytest==3.1.3
python-dateutil==2.6.1
python-editor==1.0.3
PyYAML==3.12
requests==2.18.4
rsa==3.4.2
setproctitle==1.1.10
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.10.0
SQLAlchemy==1.1.12
sqlalchemy-citext==1.3.post0
SQLAlchemy-Utils==0.32.14
sqlparse==0.2.4
terminaltables==3.1.0
testfixtures==5.3.1
traitlets==4.3.2
typing==3.6.2
typing-inspect==0.1.1
Unidecode==0.4.21
urllib3==1.22
wcwidth==0.1.7
Werkzeug==0.12.2

рассматриваемый класс, связанный с ошибкой:

class QueryProvidingObjectType(SQLAlchemyObjectType):
    class Meta:
        abstract = True

    # TODO: copy-pasta duplication here:
    @classmethod
    def QueryOne(cls, filter_fields):
        def resolver(self, args, context, info):
            query = cls.get_query(context)
            query = apply_filter(query, cls._meta.model, args)
            return query.first()
        all_fields = cls._meta.fields
        fields = {name: field_to_argument(cls, name, all_fields[name])
                  for name in filter_fields}
        return graphene.Field(
            cls,
            resolver=resolver,
            args=fields,
            description=f"Return the first {cls} that matches the filters"
            )

    @classmethod
    def QueryList(cls, filter_fields=(), sort_by=None):
        def resolver(self, args, context, info):
            query = cls.get_query(context)
            if sort_by:
                query = apply_sort(query, cls._meta.model, sort_by)
            query = apply_filter(query, cls._meta.model, args)
            return query.all()

        all_fields = cls._meta.fields
        model_fields = {name: field_to_argument(cls, name, all_fields[name])
                        for name in filter_fields}
        model_fields.update({
            "first": graphene.Int(),
            "after": graphene.Int()
        })
        description = f"Query for all {cls}s"
        if filter_fields:
            description += " (optionally filtered using provided arguments)"
        return graphene.List(
            cls,
            resolver=resolver,
            args=model_fields,
            description=description)

    @classmethod
    def FuzzySearch(cls, match_field):
        mapper = MapperFactory.get_mapper(FuzzySearchResult[cls])
        result_type = mapper.graphene_output_type()

        def resolver(self, args, context, info):
            first = args.pop('first', 5)
            attr_name, search_query = list(args.items())[0]

            query = cls.get_query(context).all()
            return fuzzy_search(search_query, query, key=attrgetter(attr_name), limit=first)

        all_fields = cls._meta.fields
        fields = {
            match_field: field_to_argument(cls, match_field, all_fields[match_field]),
            'first': graphene.Argument(
                graphene.Int,
                description="[optional] limit the number of results"
            ),
        }
        return graphene.List(result_type, resolver=resolver, args=fields)
...