Skip to content

Commit d29f608

Browse files
committed
Merge branch 'master' into features/2.0
# Conflicts: # graphene_sqlalchemy/types.py
2 parents 999b677 + 35792a8 commit d29f608

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

docs/tutorial.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ Create ``flask_sqlalchemy/schema.py`` and type the following:
9595
from graphene_sqlalchemy import SQLAlchemyObjectType, SQLAlchemyConnectionField
9696
from models import db_session, Department as DepartmentModel, Employee as EmployeeModel
9797
98-
schema = graphene.Schema()
99-
10098
10199
class Department(SQLAlchemyObjectType):
102100
class Meta:
@@ -114,7 +112,7 @@ Create ``flask_sqlalchemy/schema.py`` and type the following:
114112
node = relay.Node.Field()
115113
all_employees = SQLAlchemyConnectionField(Employee)
116114
117-
schema.query = Query
115+
schema = graphene.Schema(query=Query)
118116
119117
Creating GraphQL and GraphiQL views in Flask
120118
--------------------------------------------

graphene_sqlalchemy/fields.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def connection_resolver(cls, resolver, connection, model, root, args, context, i
3838
_len = iterable.count()
3939
else:
4040
_len = len(iterable)
41-
return connection_from_list_slice(
41+
connection = connection_from_list_slice(
4242
iterable,
4343
args,
4444
slice_start=0,
@@ -48,6 +48,9 @@ def connection_resolver(cls, resolver, connection, model, root, args, context, i
4848
pageinfo_type=PageInfo,
4949
edge_type=connection.Edge,
5050
)
51+
connection.iterable = iterable
52+
connection.length = _len
53+
return connection
5154

5255
def get_resolver(self, parent_resolver):
5356
return partial(self.connection_resolver, parent_resolver, self.type, self.model)

graphene_sqlalchemy/types.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,5 @@ def get_node(cls, id, context, info):
137137
# @annotate(info=ResolveInfo)
138138
def resolve_id(self):
139139
# graphene_type = info.parent_type.graphene_type
140-
return self.__mapper__.primary_key_from_instance(self)[0]
140+
keys = self.__mapper__.primary_key_from_instance(self)
141+
return tuple(keys) if len(keys) > 1 else keys[0]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
install_requires=[
3535
'six>=1.10.0',
36-
'graphene>=1.0',
36+
'graphene>=2.0.dev',
3737
'SQLAlchemy',
3838
'singledispatch>=3.4.0.3',
3939
'iso8601',

0 commit comments

Comments
 (0)