Skip to content

Commit 506f58c

Browse files
authored
fix: warnings in docs build (#383)
1 parent ba0597f commit 506f58c

File tree

6 files changed

+41
-29
lines changed

6 files changed

+41
-29
lines changed

docs/api.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ SQLAlchemyInterface
1111

1212
ORMField
1313
--------------------
14-
.. autoclass:: graphene_sqlalchemy.fields.ORMField
14+
.. autoclass:: graphene_sqlalchemy.types.ORMField
1515

1616
SQLAlchemyConnectionField
1717
-------------------------
18-
.. autoclass:: graphene_sqlalchemy.SQLAlchemyConnectionField
18+
.. autoclass:: graphene_sqlalchemy.SQLAlchemyConnectionField

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
# Add any paths that contain custom static files (such as style sheets) here,
179179
# relative to this directory. They are copied after the builtin static files,
180180
# so a file named "default.css" will overwrite the builtin "default.css".
181-
html_static_path = ["_static"]
181+
# html_static_path = ["_static"]
182182

183183
# Add any extra paths that contain custom files (such as robots.txt or
184184
# .htaccess) here, relative to this directory. These files are copied

docs/inheritance.rst

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
Inheritance Examples
22
====================
33

4+
45
Create interfaces from inheritance relationships
56
------------------------------------------------
6-
.. note:: If you're using `AsyncSession`, please check the section `Eager Loading & Using with AsyncSession`_.
7+
8+
.. note::
9+
If you're using `AsyncSession`, please check the chapter `Eager Loading & Using with AsyncSession`_.
10+
711
SQLAlchemy has excellent support for class inheritance hierarchies.
812
These hierarchies can be represented in your GraphQL schema by means
913
of interfaces_. Much like ObjectTypes, Interfaces in
@@ -111,8 +115,10 @@ class to the Schema constructor via the `types=` argument:
111115
112116
See also: `Graphene Interfaces <https://docs.graphene-python.org/en/latest/types/interfaces/>`_
113117

118+
114119
Eager Loading & Using with AsyncSession
115120
----------------------------------------
121+
116122
When querying the base type in multi-table inheritance or joined table inheritance, you can only directly refer to polymorphic fields when they are loaded eagerly.
117123
This restricting is in place because AsyncSessions don't allow implicit async operations such as the loads of the joined tables.
118124
To load the polymorphic fields eagerly, you can use the `with_polymorphic` attribute of the mapper args in the base model:

docs/requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
sphinx
12
# Docs template
23
http://graphene-python.org/sphinx_graphene_theme.zip

docs/tips.rst

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Tips
55
Querying
66
--------
77
.. _querying:
8+
89
In order to make querying against the database work, there are two alternatives:
910

1011
- Set the db session when you do the execution:

graphene_sqlalchemy/types.py

+29-25
Original file line numberDiff line numberDiff line change
@@ -408,13 +408,15 @@ class SQLAlchemyObjectType(SQLAlchemyBase, ObjectType):
408408
409409
Usage:
410410
411-
class MyModel(Base):
412-
id = Column(Integer(), primary_key=True)
413-
name = Column(String())
411+
.. code-block:: python
414412
415-
class MyType(SQLAlchemyObjectType):
416-
class Meta:
417-
model = MyModel
413+
class MyModel(Base):
414+
id = Column(Integer(), primary_key=True)
415+
name = Column(String())
416+
417+
class MyType(SQLAlchemyObjectType):
418+
class Meta:
419+
model = MyModel
418420
"""
419421

420422
@classmethod
@@ -450,30 +452,32 @@ class SQLAlchemyInterface(SQLAlchemyBase, Interface):
450452
451453
Usage (using joined table inheritance):
452454
453-
class MyBaseModel(Base):
454-
id = Column(Integer(), primary_key=True)
455-
type = Column(String())
456-
name = Column(String())
455+
.. code-block:: python
457456
458-
__mapper_args__ = {
459-
"polymorphic_on": type,
460-
}
457+
class MyBaseModel(Base):
458+
id = Column(Integer(), primary_key=True)
459+
type = Column(String())
460+
name = Column(String())
461461
462-
class MyChildModel(Base):
463-
date = Column(Date())
462+
__mapper_args__ = {
463+
"polymorphic_on": type,
464+
}
464465
465-
__mapper_args__ = {
466-
"polymorphic_identity": "child",
467-
}
466+
class MyChildModel(Base):
467+
date = Column(Date())
468468
469-
class MyBaseType(SQLAlchemyInterface):
470-
class Meta:
471-
model = MyBaseModel
469+
__mapper_args__ = {
470+
"polymorphic_identity": "child",
471+
}
472472
473-
class MyChildType(SQLAlchemyObjectType):
474-
class Meta:
475-
model = MyChildModel
476-
interfaces = (MyBaseType,)
473+
class MyBaseType(SQLAlchemyInterface):
474+
class Meta:
475+
model = MyBaseModel
476+
477+
class MyChildType(SQLAlchemyObjectType):
478+
class Meta:
479+
model = MyChildModel
480+
interfaces = (MyBaseType,)
477481
"""
478482

479483
@classmethod

0 commit comments

Comments
 (0)