File tree 1 file changed +7
-5
lines changed
graphene_sqlalchemy/tests
1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -604,8 +604,6 @@ class Meta:
604
604
batching = False
605
605
connection_field_factory = BatchSQLAlchemyConnectionField .from_relationship
606
606
607
- articles = ORMField (batching = False )
608
-
609
607
class ArticleType (SQLAlchemyObjectType ):
610
608
class Meta :
611
609
model = Article
@@ -637,7 +635,13 @@ def resolve_reporters(self, info):
637
635
""" , context_value = {"session" : session })
638
636
messages = sqlalchemy_logging_handler .messages
639
637
640
- select_statements = [message for message in messages if 'SELECT' in message and 'FROM articles' in message ]
638
+ if is_sqlalchemy_version_less_than ('1.3' ):
639
+ # The batched SQL statement generated is different in 1.2.x
640
+ # SQLAlchemy 1.3+ optimizes out a JOIN statement in `selectin`
641
+ # See https://git.io/JewQu
642
+ select_statements = [message for message in messages if 'SELECT' in message and 'JOIN articles' in message ]
643
+ else :
644
+ select_statements = [message for message in messages if 'SELECT' in message and 'FROM articles' in message ]
641
645
assert len (select_statements ) == 1
642
646
643
647
@@ -657,8 +661,6 @@ class Meta:
657
661
batching = True
658
662
connection_field_factory = default_connection_field_factory
659
663
660
- articles = ORMField (batching = True )
661
-
662
664
class ArticleType (SQLAlchemyObjectType ):
663
665
class Meta :
664
666
model = Article
You can’t perform that action at this time.
0 commit comments