-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into reverse_lookup
- Loading branch information
Showing
53 changed files
with
1,764 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,8 @@ prof/ | |
.env/ | ||
.venv/ | ||
result.json | ||
|
||
# CockroachDB | ||
cockroach-data/ | ||
heap_profiler/ | ||
goroutine_dump/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Joins | ||
===== | ||
|
||
Joins are handled automatically by Piccolo. They work everywhere you'd expect | ||
(select queries, where clauses, etc.). | ||
|
||
A `fluent interface <https://en.wikipedia.org/wiki/Fluent_interface>`_ is used, | ||
which lets you traverse foreign keys. | ||
|
||
Here's an example of a select query which uses joins (using the | ||
:ref:`example schema <ExampleSchema>`): | ||
|
||
.. code-block:: python | ||
# This gets the band's name, and the manager's name by joining to the | ||
# manager table: | ||
>>> await Band.select(Band.name, Band.manager.name) | ||
And a ``where`` clause which uses joins: | ||
|
||
.. code-block:: python | ||
# This automatically joins with the manager table to perform the where | ||
# clause. It only returns the columns from the band table though by default. | ||
>>> await Band.select().where(Band.manager.name == 'Guido') | ||
Left joins are used. | ||
|
||
join_on | ||
------- | ||
|
||
Joins are usually performed using ``ForeignKey`` columns, though there may be | ||
situations where you want to join using a column which isn't a ``ForeignKey``. | ||
|
||
You can do this using :meth:`join_on <piccolo.columns.base.Column.join_on>`. | ||
|
||
It's generally best to join on unique columns. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.