Skip to content

Commit

Permalink
Update flask version in examples
Browse files Browse the repository at this point in the history
Merge pull request #192 from Nabellaleen/fix-190-update-flask-example-version
Fix #190
  • Loading branch information
jnak authored Apr 1, 2019
2 parents 25dd3d0 + faadf03 commit 46c9eb7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
2 changes: 1 addition & 1 deletion examples/flask_sqlalchemy/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
graphene[sqlalchemy]
SQLAlchemy==1.0.11
Flask==0.10.1
Flask==0.12.4
Flask-GraphQL==1.3.0
21 changes: 3 additions & 18 deletions examples/flask_sqlalchemy/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,18 @@ class Meta:
interfaces = (relay.Node, )


class DepartmentConnection(relay.Connection):
class Meta:
node = Department


class Employee(SQLAlchemyObjectType):
class Meta:
model = EmployeeModel
interfaces = (relay.Node, )


class EmployeeConnection(relay.Connection):
class Meta:
node = Employee


class Role(SQLAlchemyObjectType):
class Meta:
model = RoleModel
interfaces = (relay.Node, )


class RoleConnection(relay.Connection):
class Meta:
node = Role


SortEnumEmployee = utils.sort_enum_for_model(EmployeeModel, 'SortEnumEmployee',
lambda c, d: c.upper() + ('_ASC' if d else '_DESC'))

Expand All @@ -49,14 +34,14 @@ class Query(graphene.ObjectType):
node = relay.Node.Field()
# Allow only single column sorting
all_employees = SQLAlchemyConnectionField(
EmployeeConnection,
Employee,
sort=graphene.Argument(
SortEnumEmployee,
default_value=utils.EnumValue('id_asc', EmployeeModel.id.asc())))
# Allows sorting over multiple columns, by default over the primary key
all_roles = SQLAlchemyConnectionField(RoleConnection)
all_roles = SQLAlchemyConnectionField(Role)
# Disable sorting over this field
all_departments = SQLAlchemyConnectionField(DepartmentConnection, sort=None)
all_departments = SQLAlchemyConnectionField(Department, sort=None)


schema = graphene.Schema(query=Query, types=[Department, Employee, Role])

0 comments on commit 46c9eb7

Please sign in to comment.