Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Update includes for docs/tutorial/relationship-attributes/read-relationships.md #1169

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 8 additions & 256 deletions docs/tutorial/relationship-attributes/read-relationships.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,79 +6,11 @@ Now that we know how to connect data using **relationship Attributes**, let's se

First, add a function `select_heroes()` where we get a hero to start working with, and add that function to the `main()` function:

//// tab | Python 3.10+

```Python hl_lines="3-7 14"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:94-98]!}

# Previous code here omitted 👈

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:108-111]!}

# Code below omitted 👇
```

////

//// tab | Python 3.9+

```Python hl_lines="3-7 14"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:96-100]!}

# Previous code here omitted 👈

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:110-113]!}

# Code below omitted 👇
```

////

//// tab | Python 3.7+

```Python hl_lines="3-7 14"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!}

# Previous code here omitted 👈

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:110-113]!}

# Code below omitted 👇
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:98] hl[3:7,14] *}

/// details | 👀 Full file preview

//// tab | Python 3.10+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py!}
```

////

//// tab | Python 3.9+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py!}
```

////

//// tab | Python 3.7+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!}
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py *}

///

Expand All @@ -88,67 +20,11 @@ Now that we have a hero, we can get the team this hero belongs to.

With what we have learned **up to now**, we could use a `select()` statement, then execute it with `session.exec()`, and then get the `.first()` result, for example:

//// tab | Python 3.10+

```Python hl_lines="9-12"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:94-103]!}

# Code below omitted 👇
```

////

//// tab | Python 3.9+

```Python hl_lines="9-12"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:96-105]!}

# Code below omitted 👇
```

////

//// tab | Python 3.7+

```Python hl_lines="9-12"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-105]!}

# Code below omitted 👇
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:103] hl[9:12] *}

/// details | 👀 Full file preview

//// tab | Python 3.10+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py!}
```

////

//// tab | Python 3.9+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py!}
```

////

//// tab | Python 3.7+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!}
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py *}

///

Expand All @@ -158,79 +34,11 @@ But now that we have the **relationship attributes**, we can just access them, a

So, the highlighted block above, has the same results as the block below:

//// tab | Python 3.10+

```Python hl_lines="11"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:94-98]!}

# Code from the previous example omitted 👈

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py[ln:105]!}

# Code below omitted 👇
```

////

//// tab | Python 3.9+

```Python hl_lines="11"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:96-100]!}

# Code from the previous example omitted 👈

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py[ln:107]!}

# Code below omitted 👇
```

////

//// tab | Python 3.7+

```Python hl_lines="11"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:96-100]!}

# Code from the previous example omitted 👈

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py[ln:107]!}

# Code below omitted 👇
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py ln[94:98] hl[11] *}

/// details | 👀 Full file preview

//// tab | Python 3.10+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py!}
```

////

//// tab | Python 3.9+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py39.py!}
```

////

//// tab | Python 3.7+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001.py!}
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial001_py310.py *}

///

Expand All @@ -246,67 +54,11 @@ For example, here, **inside** a `with` block with a `Session` object.

And the same way, when we are working on the **many** side of the **one-to-many** relationship, we can get a list of of the related objects just by accessing the relationship attribute:

//// tab | Python 3.10+

```Python hl_lines="9"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py[ln:94-100]!}

# Code below omitted 👇
```

////

//// tab | Python 3.9+

```Python hl_lines="9"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py39.py[ln:96-102]!}

# Code below omitted 👇
```

////

//// tab | Python 3.7+

```Python hl_lines="9"
# Code above omitted 👆

{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py[ln:96-102]!}

# Code below omitted 👇
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py ln[94:100] hl[9] *}

/// details | 👀 Full file preview

//// tab | Python 3.10+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py!}
```

////

//// tab | Python 3.9+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py39.py!}
```

////

//// tab | Python 3.7+

```Python
{!./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002.py!}
```

////
{* ./docs_src/tutorial/relationship_attributes/read_relationships/tutorial002_py310.py *}

///

Expand Down
Loading