Skip to content

Commit 64e31aa

Browse files
authored
Merge branch 'master' into association_proxy-support
2 parents b49c63e + 882205d commit 64e31aa

24 files changed

+869
-325
lines changed

.github/workflows/docs.yml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Deploy Docs
2+
3+
# Runs on pushes targeting the default branch
4+
on:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pages:
10+
runs-on: ubuntu-22.04
11+
environment:
12+
name: github-pages
13+
url: ${{ steps.deployment.outputs.page_url }}
14+
permissions:
15+
pages: write
16+
id-token: write
17+
steps:
18+
- id: deployment
19+
uses: sphinx-notes/pages@v3

.github/workflows/lint.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: Lint
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
pull_request:
8+
branches:
9+
- '*'
410

511
jobs:
612
build:

.github/workflows/manage_issues.yml

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Issue Manager
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *"
6+
issue_comment:
7+
types:
8+
- created
9+
issues:
10+
types:
11+
- labeled
12+
pull_request_target:
13+
types:
14+
- labeled
15+
workflow_dispatch:
16+
17+
permissions:
18+
issues: write
19+
pull-requests: write
20+
21+
concurrency:
22+
group: lock
23+
24+
jobs:
25+
lock-old-closed-issues:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: dessant/lock-threads@v4
29+
with:
30+
issue-inactive-days: '180'
31+
process-only: 'issues'
32+
issue-comment: >
33+
This issue has been automatically locked since there
34+
has not been any recent activity after it was closed.
35+
Please open a new issue for related topics referencing
36+
this issue.
37+
close-labelled-issues:
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: tiangolo/[email protected]
41+
with:
42+
token: ${{ secrets.GITHUB_TOKEN }}
43+
config: >
44+
{
45+
"needs-reply": {
46+
"delay": 2200000,
47+
"message": "This issue was closed due to inactivity. If your request is still relevant, please open a new issue referencing this one and provide all of the requested information."
48+
}
49+
}

.github/workflows/tests.yml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
pull_request:
88
branches:
99
- '*'
10+
1011
jobs:
1112
test:
1213
runs-on: ubuntu-latest

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ A [SQLAlchemy](http://www.sqlalchemy.org/) integration for [Graphene](http://gra
1818
For installing Graphene, just run this command in your shell.
1919

2020
```bash
21-
pip install "graphene-sqlalchemy>=3"
21+
pip install --pre "graphene-sqlalchemy"
2222
```
2323

2424
## Examples
@@ -109,11 +109,11 @@ schema = graphene.Schema(query=Query)
109109

110110
### Full Examples
111111

112-
To learn more check out the following [examples](examples/):
112+
To learn more check out the following [examples](https://github.com/graphql-python/graphene-sqlalchemy/tree/master/examples/):
113113

114-
- [Flask SQLAlchemy example](examples/flask_sqlalchemy)
115-
- [Nameko SQLAlchemy example](examples/nameko_sqlalchemy)
114+
- [Flask SQLAlchemy example](https://github.com/graphql-python/graphene-sqlalchemy/tree/master/examples/flask_sqlalchemy)
115+
- [Nameko SQLAlchemy example](https://github.com/graphql-python/graphene-sqlalchemy/tree/master/examples/nameko_sqlalchemy)
116116

117117
## Contributing
118118

119-
See [CONTRIBUTING.md](/CONTRIBUTING.md)
119+
See [CONTRIBUTING.md](https://github.com/graphql-python/graphene-sqlalchemy/blob/master/CONTRIBUTING.md)

README.rst

-102
This file was deleted.

docs/api.rst

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
API Reference
2+
==============
3+
4+
SQLAlchemyObjectType
5+
--------------------
6+
.. autoclass:: graphene_sqlalchemy.SQLAlchemyObjectType
7+
8+
SQLAlchemyInterface
9+
-------------------
10+
.. autoclass:: graphene_sqlalchemy.SQLAlchemyInterface
11+
12+
ORMField
13+
--------------------
14+
.. autoclass:: graphene_sqlalchemy.types.ORMField
15+
16+
SQLAlchemyConnectionField
17+
-------------------------
18+
.. autoclass:: graphene_sqlalchemy.SQLAlchemyConnectionField

docs/conf.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
# import os
2424
# import sys
2525
# sys.path.insert(0, os.path.abspath('.'))
26+
import os
27+
import sys
2628

29+
sys.path.insert(0, os.path.abspath(".."))
2730
# -- General configuration ------------------------------------------------
2831

2932
# If your documentation needs a minimal Sphinx version, state it here.
@@ -80,7 +83,7 @@
8083
#
8184
# This is also used if you do content translation via gettext catalogs.
8285
# Usually you set "language" from the command line for these cases.
83-
language = None
86+
language = "en"
8487

8588
# There are two options for replacing |today|: either, you set today to some
8689
# non-false value, then it is used:
@@ -175,7 +178,7 @@
175178
# Add any paths that contain custom static files (such as style sheets) here,
176179
# relative to this directory. They are copied after the builtin static files,
177180
# so a file named "default.css" will overwrite the builtin "default.css".
178-
html_static_path = ["_static"]
181+
# html_static_path = ["_static"]
179182

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

docs/index.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ Contents:
66
.. toctree::
77
:maxdepth: 0
88

9-
tutorial
9+
starter
10+
inheritance
11+
relay
1012
tips
1113
examples
14+
tutorial
15+
api

docs/inheritance.rst

+9-2
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 chapter `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,13 +115,16 @@ 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
115-
--------------------
120+
----------------------------------------
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:
119125

120126
.. code:: python
127+
121128
class Person(Base):
122129
id = Column(Integer(), primary_key=True)
123130
type = Column(String())

docs/relay.rst

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Relay
2+
==========
3+
4+
:code:`graphene-sqlalchemy` comes with pre-defined
5+
connection fields to quickly create a functioning relay API.
6+
Using the :code:`SQLAlchemyConnectionField`, you have access to relay pagination,
7+
sorting and filtering (filtering is coming soon!).
8+
9+
To be used in a relay connection, your :code:`SQLAlchemyObjectType` must implement
10+
the :code:`Node` interface from :code:`graphene.relay`. This handles the creation of
11+
the :code:`Connection` and :code:`Edge` types automatically.
12+
13+
The following example creates a relay-paginated connection:
14+
15+
16+
17+
.. code:: python
18+
19+
class Pet(Base):
20+
__tablename__ = 'pets'
21+
id = Column(Integer(), primary_key=True)
22+
name = Column(String(30))
23+
pet_kind = Column(Enum('cat', 'dog', name='pet_kind'), nullable=False)
24+
25+
26+
class PetNode(SQLAlchemyObjectType):
27+
class Meta:
28+
model = Pet
29+
interfaces=(Node,)
30+
31+
32+
class Query(ObjectType):
33+
all_pets = SQLAlchemyConnectionField(PetNode.connection)
34+
35+
To disable sorting on the connection, you can set :code:`sort` to :code:`None` the
36+
:code:`SQLAlchemyConnectionField`:
37+
38+
39+
.. code:: python
40+
41+
class Query(ObjectType):
42+
all_pets = SQLAlchemyConnectionField(PetNode.connection, sort=None)
43+

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

0 commit comments

Comments
 (0)