🔧 Update config with new pymdown extensions (#712)
* 🔧 Update config with new pymdown extensions * 📝 Update admonition blocks syntax * 📝 Update syntax for tabs with new pymdown extensions
This commit is contained in:
committed by
GitHub
parent
71baff6015
commit
a95bd3873d
@@ -30,8 +30,11 @@ The `team` table looks like this:
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
!!! tip
|
||||
Notice that it doesn't have any foreign key to other tables.
|
||||
/// tip
|
||||
|
||||
Notice that it doesn't have any foreign key to other tables.
|
||||
|
||||
///
|
||||
|
||||
And the `hero` table looks like this:
|
||||
|
||||
@@ -106,19 +109,22 @@ Specifically, the new link table `heroteamlink` would be:
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
!!! info
|
||||
Other names used for this **link table** are:
|
||||
/// info
|
||||
|
||||
* association table
|
||||
* secondary table
|
||||
* junction table
|
||||
* intermediate table
|
||||
* join table
|
||||
* through table
|
||||
* relationship table
|
||||
* connection table
|
||||
Other names used for this **link table** are:
|
||||
|
||||
I'm using the term "link table" because it's short, doesn't collide with other terms already used (e.g. "relationship"), it's easy to remember how to write it, etc.
|
||||
* association table
|
||||
* secondary table
|
||||
* junction table
|
||||
* intermediate table
|
||||
* join table
|
||||
* through table
|
||||
* relationship table
|
||||
* connection table
|
||||
|
||||
I'm using the term "link table" because it's short, doesn't collide with other terms already used (e.g. "relationship"), it's easy to remember how to write it, etc.
|
||||
|
||||
///
|
||||
|
||||
## Link Primary Key
|
||||
|
||||
|
||||
@@ -18,8 +18,11 @@ A row in the table `heroteamlink` points to **one** particular hero, but a singl
|
||||
|
||||
And also, the same row in the table `heroteamlink` points to **one** team, but a single team can be connected to **many** hero-team links, so it's also **one-to-many**.
|
||||
|
||||
!!! tip
|
||||
The previous many-to-many relationship was also just two one-to-many relationships combined, but now it's going to be much more explicit.
|
||||
/// tip
|
||||
|
||||
The previous many-to-many relationship was also just two one-to-many relationships combined, but now it's going to be much more explicit.
|
||||
|
||||
///
|
||||
|
||||
## Update Link Model
|
||||
|
||||
@@ -51,10 +54,13 @@ The new **relationship attributes** have their own `back_populates` pointing to
|
||||
* `team`: has `back_populates="hero_links"`, because in the `Team` model, the attribute will contain the links to the **team's heroes**.
|
||||
* `hero`: has `back_populates="team_links"`, because in the `Hero` model, the attribute will contain the links to the **hero's teams**.
|
||||
|
||||
!!! info
|
||||
In SQLAlchemy this is called an Association Object or Association Model.
|
||||
/// info
|
||||
|
||||
I'm calling it **Link Model** just because that's easier to write avoiding typos. But you are also free to call it however you want. 😉
|
||||
In SQLAlchemy this is called an Association Object or Association Model.
|
||||
|
||||
I'm calling it **Link Model** just because that's easier to write avoiding typos. But you are also free to call it however you want. 😉
|
||||
|
||||
///
|
||||
|
||||
## Update Team Model
|
||||
|
||||
|
||||
@@ -82,10 +82,13 @@ We can use the same **relationship attributes** to include `hero_spider_boy` in
|
||||
|
||||
</details>
|
||||
|
||||
!!! tip
|
||||
Because we are accessing an attribute in the models right after we commit, with `hero_spider_boy.teams` and `team_z_force.heroes`, the data is refreshed automatically.
|
||||
/// tip
|
||||
|
||||
So we don't have to call `session.refresh()`.
|
||||
Because we are accessing an attribute in the models right after we commit, with `hero_spider_boy.teams` and `team_z_force.heroes`, the data is refreshed automatically.
|
||||
|
||||
So we don't have to call `session.refresh()`.
|
||||
|
||||
///
|
||||
|
||||
We then commit the change, refresh, and print the updated **Spider-Boy**'s heroes to confirm.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user