🎨 Run pre-commit on all files and autoformat (#666)
@ -48,9 +48,7 @@ if __name__ == "__main__":
|
|||||||
use_pr = pr
|
use_pr = pr
|
||||||
break
|
break
|
||||||
if not use_pr:
|
if not use_pr:
|
||||||
logging.error(
|
logging.error(f"No PR found for hash: {event.workflow_run.head_commit.id}")
|
||||||
f"No PR found for hash: {event.workflow_run.head_commit.id}"
|
|
||||||
)
|
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
github_headers = {
|
github_headers = {
|
||||||
"Authorization": f"token {settings.input_token.get_secret_value()}"
|
"Authorization": f"token {settings.input_token.get_secret_value()}"
|
||||||
|
@ -90,4 +90,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
@ -202,4 +202,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@ -148,4 +148,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 37 KiB After Width: | Height: | Size: 37 KiB |
@ -81,4 +81,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
@ -34,4 +34,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
@ -61,4 +61,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 8.7 KiB After Width: | Height: | Size: 8.7 KiB |
@ -94,4 +94,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
@ -94,4 +94,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@ -94,4 +94,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -97,4 +97,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@ -94,4 +94,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -97,4 +97,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@ -97,4 +97,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 27 KiB |
@ -100,4 +100,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 28 KiB |
@ -89,4 +89,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@ -217,4 +217,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 53 KiB |
@ -130,4 +130,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@ -130,4 +130,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@ -130,4 +130,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
@ -38,4 +38,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 126 KiB After Width: | Height: | Size: 126 KiB |
@ -49,4 +49,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 130 KiB After Width: | Height: | Size: 130 KiB |
@ -139,4 +139,4 @@
|
|||||||
</root>
|
</root>
|
||||||
</mxGraphModel>
|
</mxGraphModel>
|
||||||
</diagram>
|
</diagram>
|
||||||
</mxfile>
|
</mxfile>
|
||||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
@ -72,14 +72,14 @@ class Termynal {
|
|||||||
* Initialise the widget, get lines, clear container and start animation.
|
* Initialise the widget, get lines, clear container and start animation.
|
||||||
*/
|
*/
|
||||||
init() {
|
init() {
|
||||||
/**
|
/**
|
||||||
* Calculates width and height of Termynal container.
|
* Calculates width and height of Termynal container.
|
||||||
* If container is empty and lines are dynamically loaded, defaults to browser `auto` or CSS.
|
* If container is empty and lines are dynamically loaded, defaults to browser `auto` or CSS.
|
||||||
*/
|
*/
|
||||||
const containerStyle = getComputedStyle(this.container);
|
const containerStyle = getComputedStyle(this.container);
|
||||||
this.container.style.width = containerStyle.width !== '0px' ?
|
this.container.style.width = containerStyle.width !== '0px' ?
|
||||||
containerStyle.width : undefined;
|
containerStyle.width : undefined;
|
||||||
this.container.style.minHeight = containerStyle.height !== '0px' ?
|
this.container.style.minHeight = containerStyle.height !== '0px' ?
|
||||||
containerStyle.height : undefined;
|
containerStyle.height : undefined;
|
||||||
|
|
||||||
this.container.setAttribute('data-termynal', '');
|
this.container.setAttribute('data-termynal', '');
|
||||||
@ -138,7 +138,7 @@ class Termynal {
|
|||||||
restart.innerHTML = "restart ↻"
|
restart.innerHTML = "restart ↻"
|
||||||
return restart
|
return restart
|
||||||
}
|
}
|
||||||
|
|
||||||
generateFinish() {
|
generateFinish() {
|
||||||
const finish = document.createElement('a')
|
const finish = document.createElement('a')
|
||||||
finish.onclick = (e) => {
|
finish.onclick = (e) => {
|
||||||
@ -215,7 +215,7 @@ class Termynal {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts line data objects into line elements.
|
* Converts line data objects into line elements.
|
||||||
*
|
*
|
||||||
* @param {Object[]} lineData - Dynamically loaded lines.
|
* @param {Object[]} lineData - Dynamically loaded lines.
|
||||||
* @param {Object} line - Line data object.
|
* @param {Object} line - Line data object.
|
||||||
* @returns {Element[]} - Array of line elements.
|
* @returns {Element[]} - Array of line elements.
|
||||||
@ -231,7 +231,7 @@ class Termynal {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function for generating attributes string.
|
* Helper function for generating attributes string.
|
||||||
*
|
*
|
||||||
* @param {Object} line - Line data object.
|
* @param {Object} line - Line data object.
|
||||||
* @returns {string} - String of attributes.
|
* @returns {string} - String of attributes.
|
||||||
*/
|
*/
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
<qa-bot
|
<qa-bot
|
||||||
server="https://tiangolo-sqlmodel.docsqa.jina.ai"
|
server="https://tiangolo-sqlmodel.docsqa.jina.ai"
|
||||||
theme="infer"
|
theme="infer"
|
||||||
title="SQLModel Bot"
|
title="SQLModel Bot"
|
||||||
description="SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness."
|
description="SQLModel, SQL databases in Python, designed for simplicity, compatibility, and robustness."
|
||||||
style="font-size: 0.8rem"
|
style="font-size: 0.8rem"
|
||||||
@ -28,4 +28,4 @@
|
|||||||
</dl>
|
</dl>
|
||||||
</template>
|
</template>
|
||||||
</qa-bot>
|
</qa-bot>
|
||||||
{%- endblock %}
|
{%- endblock %}
|
||||||
|
@ -198,9 +198,9 @@ INFO Engine COMMIT
|
|||||||
|
|
||||||
// And now our prints
|
// And now our prints
|
||||||
After committing the session
|
After committing the session
|
||||||
Hero 1:
|
Hero 1:
|
||||||
Hero 2:
|
Hero 2:
|
||||||
Hero 3:
|
Hero 3:
|
||||||
|
|
||||||
// What is happening here? 😱
|
// What is happening here? 😱
|
||||||
```
|
```
|
||||||
@ -275,17 +275,17 @@ $ python app.py
|
|||||||
|
|
||||||
// After committing, the objects are expired and have no values
|
// After committing, the objects are expired and have no values
|
||||||
After committing the session
|
After committing the session
|
||||||
Hero 1:
|
Hero 1:
|
||||||
Hero 2:
|
Hero 2:
|
||||||
Hero 3:
|
Hero 3:
|
||||||
|
|
||||||
// Now we will access an attribute like the ID, this is the first print
|
// Now we will access an attribute like the ID, this is the first print
|
||||||
After committing the session, show IDs
|
After committing the session, show IDs
|
||||||
|
|
||||||
// Notice that before printing the first ID, the Session makes the Engine go to the database to refresh the data 🤓
|
// Notice that before printing the first ID, the Session makes the Engine go to the database to refresh the data 🤓
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00017s] (1,)
|
INFO Engine [generated in 0.00017s] (1,)
|
||||||
|
|
||||||
@ -293,8 +293,8 @@ INFO Engine [generated in 0.00017s] (1,)
|
|||||||
Hero 1 ID: 1
|
Hero 1 ID: 1
|
||||||
|
|
||||||
// Before the next print, refresh the data for the second object
|
// Before the next print, refresh the data for the second object
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001245s ago] (2,)
|
INFO Engine [cached since 0.001245s ago] (2,)
|
||||||
|
|
||||||
@ -302,8 +302,8 @@ INFO Engine [cached since 0.001245s ago] (2,)
|
|||||||
Hero 2 ID: 2
|
Hero 2 ID: 2
|
||||||
|
|
||||||
// Before the third print, refresh its data
|
// Before the third print, refresh its data
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002215s ago] (3,)
|
INFO Engine [cached since 0.002215s ago] (3,)
|
||||||
|
|
||||||
@ -365,20 +365,20 @@ $ python app.py
|
|||||||
// Output above omitted 👆
|
// Output above omitted 👆
|
||||||
|
|
||||||
// The first refresh
|
// The first refresh
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00024s] (1,)
|
INFO Engine [generated in 0.00024s] (1,)
|
||||||
|
|
||||||
// The second refresh
|
// The second refresh
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001487s ago] (2,)
|
INFO Engine [cached since 0.001487s ago] (2,)
|
||||||
|
|
||||||
// The third refresh
|
// The third refresh
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002377s ago] (3,)
|
INFO Engine [cached since 0.002377s ago] (3,)
|
||||||
|
|
||||||
@ -468,12 +468,12 @@ INFO Engine PRAGMA main.table_info("hero")
|
|||||||
INFO Engine [raw sql] ()
|
INFO Engine [raw sql] ()
|
||||||
INFO Engine PRAGMA temp.table_info("hero")
|
INFO Engine PRAGMA temp.table_info("hero")
|
||||||
INFO Engine [raw sql] ()
|
INFO Engine [raw sql] ()
|
||||||
INFO Engine
|
INFO Engine
|
||||||
CREATE TABLE hero (
|
CREATE TABLE hero (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
secret_name VARCHAR NOT NULL,
|
secret_name VARCHAR NOT NULL,
|
||||||
age INTEGER,
|
age INTEGER,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -497,23 +497,23 @@ INFO Engine INSERT INTO hero (name, secret_name, age) VALUES (?, ?, ?)
|
|||||||
INFO Engine [cached since 0.001483s ago] ('Rusty-Man', 'Tommy Sharp', 48)
|
INFO Engine [cached since 0.001483s ago] ('Rusty-Man', 'Tommy Sharp', 48)
|
||||||
INFO Engine COMMIT
|
INFO Engine COMMIT
|
||||||
After committing the session
|
After committing the session
|
||||||
Hero 1:
|
Hero 1:
|
||||||
Hero 2:
|
Hero 2:
|
||||||
Hero 3:
|
Hero 3:
|
||||||
After committing the session, show IDs
|
After committing the session, show IDs
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00029s] (1,)
|
INFO Engine [generated in 0.00029s] (1,)
|
||||||
Hero 1 ID: 1
|
Hero 1 ID: 1
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002132s ago] (2,)
|
INFO Engine [cached since 0.002132s ago] (2,)
|
||||||
Hero 2 ID: 2
|
Hero 2 ID: 2
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.003367s ago] (3,)
|
INFO Engine [cached since 0.003367s ago] (3,)
|
||||||
Hero 3 ID: 3
|
Hero 3 ID: 3
|
||||||
@ -521,16 +521,16 @@ After committing the session, show names
|
|||||||
Hero 1 name: Deadpond
|
Hero 1 name: Deadpond
|
||||||
Hero 2 name: Spider-Boy
|
Hero 2 name: Spider-Boy
|
||||||
Hero 3 name: Rusty-Man
|
Hero 3 name: Rusty-Man
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00025s] (1,)
|
INFO Engine [generated in 0.00025s] (1,)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001583s ago] (2,)
|
INFO Engine [cached since 0.001583s ago] (2,)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002722s ago] (3,)
|
INFO Engine [cached since 0.002722s ago] (3,)
|
||||||
After refreshing the heroes
|
After refreshing the heroes
|
||||||
|
@ -159,7 +159,7 @@ As the `Hero` class model now has a field (column, attribute) `team_id`, we can
|
|||||||
|
|
||||||
We haven't committed this hero to the database yet, but there are already a couple of things to pay **attention** to.
|
We haven't committed this hero to the database yet, but there are already a couple of things to pay **attention** to.
|
||||||
|
|
||||||
If the database already had some teams, we wouldn't even know **what is the ID** that is going to be automatically assigned to each team by the database, for example, we couldn't just guess `1` or `2`.
|
If the database already had some teams, we wouldn't even know **what is the ID** that is going to be automatically assigned to each team by the database, for example, we couldn't just guess `1` or `2`.
|
||||||
|
|
||||||
But once the team is created and committed to the database, we can access the object's `id` field to get that ID.
|
But once the team is created and committed to the database, we can access the object's `id` field to get that ID.
|
||||||
|
|
||||||
@ -171,8 +171,8 @@ That line alone would generate an output of:
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [generated in 0.00025s] (2,)
|
INFO Engine [generated in 0.00025s] (2,)
|
||||||
```
|
```
|
||||||
@ -199,8 +199,8 @@ Let's now create two more heroes:
|
|||||||
When creating `hero_rusty_man`, we are accessing `team_preventers.id`, so that will also trigger a refresh of its data, generating an output of:
|
When creating `hero_rusty_man`, we are accessing `team_preventers.id`, so that will also trigger a refresh of its data, generating an output of:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [cached since 0.001795s ago] (1,)
|
INFO Engine [cached since 0.001795s ago] (1,)
|
||||||
```
|
```
|
||||||
@ -256,18 +256,18 @@ $ python app.py
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// Refresh the first hero
|
// Refresh the first hero
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00021s] (1,)
|
INFO Engine [generated in 0.00021s] (1,)
|
||||||
// Refresh the second hero
|
// Refresh the second hero
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001575s ago] (2,)
|
INFO Engine [cached since 0.001575s ago] (2,)
|
||||||
// Refresh the third hero
|
// Refresh the third hero
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002518s ago] (3,)
|
INFO Engine [cached since 0.002518s ago] (3,)
|
||||||
|
|
||||||
|
@ -191,24 +191,24 @@ INFO Engine PRAGMA temp.table_info("hero")
|
|||||||
INFO Engine [raw sql] ()
|
INFO Engine [raw sql] ()
|
||||||
|
|
||||||
// Create the tables
|
// Create the tables
|
||||||
INFO Engine
|
INFO Engine
|
||||||
CREATE TABLE team (
|
CREATE TABLE team (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
headquarters VARCHAR NOT NULL,
|
headquarters VARCHAR NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
INFO Engine [no key 0.00010s] ()
|
INFO Engine [no key 0.00010s] ()
|
||||||
INFO Engine
|
INFO Engine
|
||||||
CREATE TABLE hero (
|
CREATE TABLE hero (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
secret_name VARCHAR NOT NULL,
|
secret_name VARCHAR NOT NULL,
|
||||||
age INTEGER,
|
age INTEGER,
|
||||||
team_id INTEGER,
|
team_id INTEGER,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY(team_id) REFERENCES team (id)
|
FOREIGN KEY(team_id) REFERENCES team (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -229,9 +229,9 @@ So, the first SQL could also be written as:
|
|||||||
|
|
||||||
```SQL
|
```SQL
|
||||||
CREATE TABLE team (
|
CREATE TABLE team (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
headquarters TEXT NOT NULL,
|
headquarters TEXT NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
@ -240,12 +240,12 @@ And the second table could be written as:
|
|||||||
|
|
||||||
```SQL hl_lines="8"
|
```SQL hl_lines="8"
|
||||||
CREATE TABLE hero (
|
CREATE TABLE hero (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name TEXT NOT NULL,
|
name TEXT NOT NULL,
|
||||||
secret_name TEXT NOT NULL,
|
secret_name TEXT NOT NULL,
|
||||||
age INTEGER,
|
age INTEGER,
|
||||||
team_id INTEGER,
|
team_id INTEGER,
|
||||||
PRIMARY KEY (id),
|
PRIMARY KEY (id),
|
||||||
FOREIGN KEY(team_id) REFERENCES team (id)
|
FOREIGN KEY(team_id) REFERENCES team (id)
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
@ -203,8 +203,8 @@ $ python app.py
|
|||||||
// Previous output omitted 😉
|
// Previous output omitted 😉
|
||||||
|
|
||||||
// Get the heroes with their teams
|
// Get the heroes with their teams
|
||||||
2021-08-09 08:55:50,682 INFO sqlalchemy.engine.Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
2021-08-09 08:55:50,682 INFO sqlalchemy.engine.Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
||||||
FROM hero, team
|
FROM hero, team
|
||||||
WHERE hero.team_id = team.id
|
WHERE hero.team_id = team.id
|
||||||
2021-08-09 08:55:50,682 INFO sqlalchemy.engine.Engine [no key 0.00015s] ()
|
2021-08-09 08:55:50,682 INFO sqlalchemy.engine.Engine [no key 0.00015s] ()
|
||||||
|
|
||||||
@ -323,7 +323,7 @@ $ python app.py
|
|||||||
// Previous output omitted 😉
|
// Previous output omitted 😉
|
||||||
|
|
||||||
// Select using a JOIN with automatic ON
|
// Select using a JOIN with automatic ON
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
||||||
FROM hero JOIN team ON team.id = hero.team_id
|
FROM hero JOIN team ON team.id = hero.team_id
|
||||||
INFO Engine [no key 0.00032s] ()
|
INFO Engine [no key 0.00032s] ()
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ $ python app.py
|
|||||||
// Previous output omitted 😉
|
// Previous output omitted 😉
|
||||||
|
|
||||||
// SELECT using LEFT OUTER JOIN
|
// SELECT using LEFT OUTER JOIN
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
||||||
FROM hero LEFT OUTER JOIN team ON team.id = hero.team_id
|
FROM hero LEFT OUTER JOIN team ON team.id = hero.team_id
|
||||||
|
|
||||||
INFO Engine [no key 0.00051s] ()
|
INFO Engine [no key 0.00051s] ()
|
||||||
@ -522,9 +522,9 @@ If we run that, it would output:
|
|||||||
$ python app.py
|
$ python app.py
|
||||||
|
|
||||||
// Select only the hero data
|
// Select only the hero data
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
||||||
// But still join with the team table
|
// But still join with the team table
|
||||||
FROM hero JOIN team ON team.id = hero.team_id
|
FROM hero JOIN team ON team.id = hero.team_id
|
||||||
// And filter with WHERE to get only the Preventers
|
// And filter with WHERE to get only the Preventers
|
||||||
WHERE team.name = ?
|
WHERE team.name = ?
|
||||||
INFO Engine [no key 0.00066s] ('Preventers',)
|
INFO Engine [no key 0.00066s] ('Preventers',)
|
||||||
@ -564,9 +564,9 @@ And if we run that, it will output:
|
|||||||
$ python app.py
|
$ python app.py
|
||||||
|
|
||||||
// Select the hero and the team data
|
// Select the hero and the team data
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id, team.id AS id_1, team.name AS name_1, team.headquarters
|
||||||
// Join the hero with the team table
|
// Join the hero with the team table
|
||||||
FROM hero JOIN team ON team.id = hero.team_id
|
FROM hero JOIN team ON team.id = hero.team_id
|
||||||
// Filter with WHERE to get only Preventers
|
// Filter with WHERE to get only Preventers
|
||||||
WHERE team.name = ?
|
WHERE team.name = ?
|
||||||
INFO Engine [no key 0.00018s] ('Preventers',)
|
INFO Engine [no key 0.00018s] ('Preventers',)
|
||||||
|
@ -56,7 +56,7 @@ We can simply set the `team_id` to `None`, and now it doesn't have a connection
|
|||||||
# Code above omitted 👆
|
# Code above omitted 👆
|
||||||
|
|
||||||
{!./docs_src/tutorial/connect/delete/tutorial001.py[ln:31-32]!}
|
{!./docs_src/tutorial/connect/delete/tutorial001.py[ln:31-32]!}
|
||||||
|
|
||||||
# Previous code here omitted 👈
|
# Previous code here omitted 👈
|
||||||
|
|
||||||
{!./docs_src/tutorial/connect/delete/tutorial001.py[ln:68-72]!}
|
{!./docs_src/tutorial/connect/delete/tutorial001.py[ln:68-72]!}
|
||||||
@ -94,8 +94,8 @@ INFO Engine COMMIT
|
|||||||
// Automatically start a new transaction
|
// Automatically start a new transaction
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
// Refresh the hero
|
// Refresh the hero
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.1661s ago] (3,)
|
INFO Engine [cached since 0.1661s ago] (3,)
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ Doing it is just like updating any other field:
|
|||||||
# Code above omitted 👆
|
# Code above omitted 👆
|
||||||
|
|
||||||
{!./docs_src/tutorial/connect/update/tutorial001.py[ln:31-32]!}
|
{!./docs_src/tutorial/connect/update/tutorial001.py[ln:31-32]!}
|
||||||
|
|
||||||
# Previous code here omitted 👈
|
# Previous code here omitted 👈
|
||||||
|
|
||||||
{!./docs_src/tutorial/connect/update/tutorial001.py[ln:62-66]!}
|
{!./docs_src/tutorial/connect/update/tutorial001.py[ln:62-66]!}
|
||||||
@ -94,8 +94,8 @@ INFO Engine COMMIT
|
|||||||
// Automatically start a new transaction
|
// Automatically start a new transaction
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
// Refresh the hero data
|
// Refresh the hero data
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age, hero.team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.08837s ago] (3,)
|
INFO Engine [cached since 0.08837s ago] (3,)
|
||||||
|
|
||||||
|
@ -422,15 +422,15 @@ INFO Engine PRAGMA main.table_info("hero")
|
|||||||
INFO Engine [raw sql] ()
|
INFO Engine [raw sql] ()
|
||||||
INFO Engine PRAGMA temp.table_info("hero")
|
INFO Engine PRAGMA temp.table_info("hero")
|
||||||
INFO Engine [raw sql] ()
|
INFO Engine [raw sql] ()
|
||||||
INFO Engine
|
INFO Engine
|
||||||
|
|
||||||
// Finally, the glorious SQL to create the table ✨
|
// Finally, the glorious SQL to create the table ✨
|
||||||
|
|
||||||
CREATE TABLE hero (
|
CREATE TABLE hero (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
secret_name VARCHAR NOT NULL,
|
secret_name VARCHAR NOT NULL,
|
||||||
age INTEGER,
|
age INTEGER,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -108,8 +108,8 @@ $ python app.py
|
|||||||
|
|
||||||
// The SELECT with WHERE
|
// The SELECT with WHERE
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00011s] ('Spider-Youngster',)
|
INFO Engine [no key 0.00011s] ('Spider-Youngster',)
|
||||||
|
|
||||||
@ -272,8 +272,8 @@ $ python app.py
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// SQL to search for the hero
|
// SQL to search for the hero
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00013s] ('Spider-Youngster',)
|
INFO Engine [no key 0.00013s] ('Spider-Youngster',)
|
||||||
```
|
```
|
||||||
|
@ -132,7 +132,7 @@ Here are the commands you could use:
|
|||||||
<div class="termy">
|
<div class="termy">
|
||||||
|
|
||||||
```console
|
```console
|
||||||
// Remember that you might need to use python3.9 or similar 💡
|
// Remember that you might need to use python3.9 or similar 💡
|
||||||
// Create the virtual environment using the module "venv"
|
// Create the virtual environment using the module "venv"
|
||||||
$ python3 -m venv env
|
$ python3 -m venv env
|
||||||
// ...here it creates the virtual environment in the directory "env"
|
// ...here it creates the virtual environment in the directory "env"
|
||||||
|
@ -342,10 +342,10 @@ $ python app.py
|
|||||||
|
|
||||||
// Create the table
|
// Create the table
|
||||||
CREATE TABLE hero (
|
CREATE TABLE hero (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
secret_name VARCHAR NOT NULL,
|
secret_name VARCHAR NOT NULL,
|
||||||
age INTEGER,
|
age INTEGER,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -353,8 +353,8 @@ CREATE TABLE hero (
|
|||||||
CREATE INDEX ix_hero_name ON hero (name)
|
CREATE INDEX ix_hero_name ON hero (name)
|
||||||
|
|
||||||
// The SELECT with WHERE looks the same
|
// The SELECT with WHERE looks the same
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00014s] ('Deadpond',)
|
INFO Engine [no key 0.00014s] ('Deadpond',)
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ $ python app.py
|
|||||||
// Previous output omitted 🙈
|
// Previous output omitted 🙈
|
||||||
|
|
||||||
// Select with LIMIT
|
// Select with LIMIT
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
LIMIT ? OFFSET ?
|
LIMIT ? OFFSET ?
|
||||||
INFO Engine [no key 0.00014s] (3, 0)
|
INFO Engine [no key 0.00014s] (3, 0)
|
||||||
@ -165,7 +165,7 @@ $python app.py
|
|||||||
// Previous output omitted 🙈
|
// Previous output omitted 🙈
|
||||||
|
|
||||||
// Select with LIMIT and OFFSET
|
// Select with LIMIT and OFFSET
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
LIMIT ? OFFSET ?
|
LIMIT ? OFFSET ?
|
||||||
INFO Engine [no key 0.00020s] (3, 3)
|
INFO Engine [no key 0.00020s] (3, 3)
|
||||||
@ -221,7 +221,7 @@ $ python app.py
|
|||||||
// Previous output omitted 🙈
|
// Previous output omitted 🙈
|
||||||
|
|
||||||
// Select last batch with LIMIT and OFFSET
|
// Select last batch with LIMIT and OFFSET
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
LIMIT ? OFFSET ?
|
LIMIT ? OFFSET ?
|
||||||
INFO Engine [no key 0.00038s] (3, 6)
|
INFO Engine [no key 0.00038s] (3, 6)
|
||||||
@ -241,7 +241,7 @@ You probably noticed the new SQL keywords `LIMIT` and `OFFSET`.
|
|||||||
You can use them in SQL, at the end of the other parts:
|
You can use them in SQL, at the end of the other parts:
|
||||||
|
|
||||||
```SQL
|
```SQL
|
||||||
SELECT id, name, secret_name, age
|
SELECT id, name, secret_name, age
|
||||||
FROM hero
|
FROM hero
|
||||||
LIMIT 3 OFFSET 6
|
LIMIT 3 OFFSET 6
|
||||||
```
|
```
|
||||||
@ -285,8 +285,8 @@ $ python app.py
|
|||||||
// Previous output omitted 🙈
|
// Previous output omitted 🙈
|
||||||
|
|
||||||
// Select with WHERE and LIMIT
|
// Select with WHERE and LIMIT
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.age > ?
|
WHERE hero.age > ?
|
||||||
LIMIT ? OFFSET ?
|
LIMIT ? OFFSET ?
|
||||||
INFO Engine [no key 0.00022s] (32, 3, 0)
|
INFO Engine [no key 0.00022s] (32, 3, 0)
|
||||||
|
@ -122,16 +122,16 @@ INFO Engine COMMIT
|
|||||||
// Automatically start a new transaction
|
// Automatically start a new transaction
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
// Refresh the data
|
// Refresh the data
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00019s] (1,)
|
INFO Engine [generated in 0.00019s] (1,)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001959s ago] (2,)
|
INFO Engine [cached since 0.001959s ago] (2,)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.003215s ago] (3,)
|
INFO Engine [cached since 0.003215s ago] (3,)
|
||||||
|
|
||||||
@ -139,8 +139,8 @@ INFO Engine [cached since 0.003215s ago] (3,)
|
|||||||
Deadpond: name='Deadpond' age=None id=1 secret_name='Dive Wilson'
|
Deadpond: name='Deadpond' age=None id=1 secret_name='Dive Wilson'
|
||||||
|
|
||||||
// Accessing the .team attribute triggers a refresh
|
// Accessing the .team attribute triggers a refresh
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team, heroteamlink
|
FROM team, heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
||||||
INFO Engine [generated in 0.00025s] (1,)
|
INFO Engine [generated in 0.00025s] (1,)
|
||||||
|
|
||||||
@ -151,8 +151,8 @@ Deadpond teams: [Team(id=1, name='Z-Force', headquarters='Sister Margaret’s Ba
|
|||||||
Rusty-Man: name='Rusty-Man' age=48 id=2 secret_name='Tommy Sharp'
|
Rusty-Man: name='Rusty-Man' age=48 id=2 secret_name='Tommy Sharp'
|
||||||
|
|
||||||
// Accessing the .team attribute triggers a refresh
|
// Accessing the .team attribute triggers a refresh
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team, heroteamlink
|
FROM team, heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.001716s ago] (2,)
|
INFO Engine [cached since 0.001716s ago] (2,)
|
||||||
|
|
||||||
@ -163,8 +163,8 @@ Rusty-Man Teams: [Team(id=2, name='Preventers', headquarters='Sharp Tower')]
|
|||||||
Spider-Boy: name='Spider-Boy' age=None id=3 secret_name='Pedro Parqueador'
|
Spider-Boy: name='Spider-Boy' age=None id=3 secret_name='Pedro Parqueador'
|
||||||
|
|
||||||
// Accessing the .team attribute triggers a refresh
|
// Accessing the .team attribute triggers a refresh
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team, heroteamlink
|
FROM team, heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.002739s ago] (3,)
|
INFO Engine [cached since 0.002739s ago] (3,)
|
||||||
|
|
||||||
|
@ -151,35 +151,35 @@ $ python app.py
|
|||||||
|
|
||||||
// Boilerplate omitted 😉
|
// Boilerplate omitted 😉
|
||||||
|
|
||||||
INFO Engine
|
INFO Engine
|
||||||
CREATE TABLE team (
|
CREATE TABLE team (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
headquarters VARCHAR NOT NULL,
|
headquarters VARCHAR NOT NULL,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
INFO Engine [no key 0.00033s] ()
|
INFO Engine [no key 0.00033s] ()
|
||||||
INFO Engine
|
INFO Engine
|
||||||
CREATE TABLE hero (
|
CREATE TABLE hero (
|
||||||
id INTEGER,
|
id INTEGER,
|
||||||
name VARCHAR NOT NULL,
|
name VARCHAR NOT NULL,
|
||||||
secret_name VARCHAR NOT NULL,
|
secret_name VARCHAR NOT NULL,
|
||||||
age INTEGER,
|
age INTEGER,
|
||||||
PRIMARY KEY (id)
|
PRIMARY KEY (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
INFO Engine [no key 0.00016s] ()
|
INFO Engine [no key 0.00016s] ()
|
||||||
INFO Engine
|
INFO Engine
|
||||||
|
|
||||||
// Our shinny new link table ✨
|
// Our shinny new link table ✨
|
||||||
CREATE TABLE heroteamlink (
|
CREATE TABLE heroteamlink (
|
||||||
team_id INTEGER,
|
team_id INTEGER,
|
||||||
hero_id INTEGER,
|
hero_id INTEGER,
|
||||||
PRIMARY KEY (team_id, hero_id),
|
PRIMARY KEY (team_id, hero_id),
|
||||||
FOREIGN KEY(team_id) REFERENCES team (id),
|
FOREIGN KEY(team_id) REFERENCES team (id),
|
||||||
FOREIGN KEY(hero_id) REFERENCES hero (id)
|
FOREIGN KEY(hero_id) REFERENCES hero (id)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -165,16 +165,16 @@ INFO Engine COMMIT
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// Automatically fetch the data on attribute access
|
// Automatically fetch the data on attribute access
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [generated in 0.00028s] (1,)
|
INFO Engine [generated in 0.00028s] (1,)
|
||||||
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
||||||
FROM heroteamlink
|
FROM heroteamlink
|
||||||
WHERE ? = heroteamlink.team_id
|
WHERE ? = heroteamlink.team_id
|
||||||
INFO Engine [generated in 0.00026s] (1,)
|
INFO Engine [generated in 0.00026s] (1,)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00024s] (1,)
|
INFO Engine [generated in 0.00024s] (1,)
|
||||||
|
|
||||||
@ -182,12 +182,12 @@ INFO Engine [generated in 0.00024s] (1,)
|
|||||||
Z-Force hero: name='Deadpond' age=None id=1 secret_name='Dive Wilson' is training: False
|
Z-Force hero: name='Deadpond' age=None id=1 secret_name='Dive Wilson' is training: False
|
||||||
|
|
||||||
// Automatically fetch the data on attribute access
|
// Automatically fetch the data on attribute access
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [cached since 0.008822s ago] (2,)
|
INFO Engine [cached since 0.008822s ago] (2,)
|
||||||
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
||||||
FROM heroteamlink
|
FROM heroteamlink
|
||||||
WHERE ? = heroteamlink.team_id
|
WHERE ? = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.005778s ago] (2,)
|
INFO Engine [cached since 0.005778s ago] (2,)
|
||||||
|
|
||||||
@ -195,8 +195,8 @@ INFO Engine [cached since 0.005778s ago] (2,)
|
|||||||
Preventers hero: name='Deadpond' age=None id=1 secret_name='Dive Wilson' is training: True
|
Preventers hero: name='Deadpond' age=None id=1 secret_name='Dive Wilson' is training: True
|
||||||
|
|
||||||
// Automatically fetch the data on attribute access
|
// Automatically fetch the data on attribute access
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.004196s ago] (2,)
|
INFO Engine [cached since 0.004196s ago] (2,)
|
||||||
|
|
||||||
@ -204,8 +204,8 @@ INFO Engine [cached since 0.004196s ago] (2,)
|
|||||||
Preventers hero: name='Spider-Boy' age=None id=2 secret_name='Pedro Parqueador' is training: True
|
Preventers hero: name='Spider-Boy' age=None id=2 secret_name='Pedro Parqueador' is training: True
|
||||||
|
|
||||||
// Automatically fetch the data on attribute access
|
// Automatically fetch the data on attribute access
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.006005s ago] (3,)
|
INFO Engine [cached since 0.006005s ago] (3,)
|
||||||
|
|
||||||
@ -253,14 +253,14 @@ $ python app.py
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// Select the hero
|
// Select the hero
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00014s] ('Spider-Boy',)
|
INFO Engine [no key 0.00014s] ('Spider-Boy',)
|
||||||
|
|
||||||
// Select the team
|
// Select the team
|
||||||
INFO Engine SELECT team.id, team.name, team.headquarters
|
INFO Engine SELECT team.id, team.name, team.headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.name = ?
|
WHERE team.name = ?
|
||||||
INFO Engine [no key 0.00012s] ('Z-Force',)
|
INFO Engine [no key 0.00012s] ('Z-Force',)
|
||||||
|
|
||||||
@ -269,18 +269,18 @@ INFO Engine INSERT INTO heroteamlink (team_id, hero_id, is_training) VALUES (?,
|
|||||||
INFO Engine [generated in 0.00023s] (1, 2, 1)
|
INFO Engine [generated in 0.00023s] (1, 2, 1)
|
||||||
|
|
||||||
// Automatically refresh the data on attribute access
|
// Automatically refresh the data on attribute access
|
||||||
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
||||||
FROM heroteamlink
|
FROM heroteamlink
|
||||||
WHERE ? = heroteamlink.team_id
|
WHERE ? = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.01514s ago] (1,)
|
INFO Engine [cached since 0.01514s ago] (1,)
|
||||||
INFO Engine COMMIT
|
INFO Engine COMMIT
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.08953s ago] (2,)
|
INFO Engine [cached since 0.08953s ago] (2,)
|
||||||
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
||||||
FROM heroteamlink
|
FROM heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id
|
WHERE ? = heroteamlink.hero_id
|
||||||
INFO Engine [generated in 0.00018s] (2,)
|
INFO Engine [generated in 0.00018s] (2,)
|
||||||
|
|
||||||
@ -291,18 +291,18 @@ Updated Spider-Boy's Teams: [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// Automatically refresh team data on attribute access
|
// Automatically refresh team data on attribute access
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [cached since 0.1084s ago] (1,)
|
INFO Engine [cached since 0.1084s ago] (1,)
|
||||||
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
||||||
FROM heroteamlink
|
FROM heroteamlink
|
||||||
WHERE ? = heroteamlink.team_id
|
WHERE ? = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.1054s ago] (1,)
|
INFO Engine [cached since 0.1054s ago] (1,)
|
||||||
|
|
||||||
// Print team hero links
|
// Print team hero links
|
||||||
Z-Force heroes: [
|
Z-Force heroes: [
|
||||||
HeroTeamLink(team_id=1, is_training=False, hero_id=1),
|
HeroTeamLink(team_id=1, is_training=False, hero_id=1),
|
||||||
HeroTeamLink(team_id=1, is_training=True, hero_id=2)
|
HeroTeamLink(team_id=1, is_training=True, hero_id=2)
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -350,8 +350,8 @@ $ python app.py
|
|||||||
// Previous output omitted 🙈
|
// Previous output omitted 🙈
|
||||||
|
|
||||||
// Automatically fetch team data on attribute access
|
// Automatically fetch team data on attribute access
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [generated in 0.00015s] (2,)
|
INFO Engine [generated in 0.00015s] (2,)
|
||||||
|
|
||||||
@ -366,16 +366,16 @@ INFO Engine COMMIT
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// Automatically fetch data on attribute access
|
// Automatically fetch data on attribute access
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.2004s ago] (2,)
|
INFO Engine [cached since 0.2004s ago] (2,)
|
||||||
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
INFO Engine SELECT heroteamlink.team_id AS heroteamlink_team_id, heroteamlink.hero_id AS heroteamlink_hero_id, heroteamlink.is_training AS heroteamlink_is_training
|
||||||
FROM heroteamlink
|
FROM heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id
|
WHERE ? = heroteamlink.hero_id
|
||||||
INFO Engine [cached since 0.1005s ago] (2,)
|
INFO Engine [cached since 0.1005s ago] (2,)
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [cached since 0.09707s ago] (2,)
|
INFO Engine [cached since 0.09707s ago] (2,)
|
||||||
|
|
||||||
@ -383,8 +383,8 @@ INFO Engine [cached since 0.09707s ago] (2,)
|
|||||||
Spider-Boy team: headquarters='Sharp Tower' id=2 name='Preventers' is training: False
|
Spider-Boy team: headquarters='Sharp Tower' id=2 name='Preventers' is training: False
|
||||||
|
|
||||||
// Automatically fetch data on attribute access
|
// Automatically fetch data on attribute access
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [cached since 0.2097s ago] (1,)
|
INFO Engine [cached since 0.2097s ago] (1,)
|
||||||
|
|
||||||
|
@ -115,12 +115,12 @@ INFO Engine COMMIT
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// Automatically refresh the data while accessing the attribute .teams
|
// Automatically refresh the data while accessing the attribute .teams
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00044s] (3,)
|
INFO Engine [generated in 0.00044s] (3,)
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team, heroteamlink
|
FROM team, heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.1648s ago] (3,)
|
INFO Engine [cached since 0.1648s ago] (3,)
|
||||||
|
|
||||||
@ -131,8 +131,8 @@ Updated Spider-Boy's Teams: [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// Automatically refresh the data while accessing the attribute .heores
|
// Automatically refresh the data while accessing the attribute .heores
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero, heroteamlink
|
FROM hero, heroteamlink
|
||||||
WHERE ? = heroteamlink.team_id AND hero.id = heroteamlink.hero_id
|
WHERE ? = heroteamlink.team_id AND hero.id = heroteamlink.hero_id
|
||||||
INFO Engine [cached since 0.1499s ago] (1,)
|
INFO Engine [cached since 0.1499s ago] (1,)
|
||||||
|
|
||||||
@ -208,12 +208,12 @@ INFO Engine COMMIT
|
|||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
|
|
||||||
// Automatically refresh the data while accessing the attribute .heroes
|
// Automatically refresh the data while accessing the attribute .heroes
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team
|
FROM team
|
||||||
WHERE team.id = ?
|
WHERE team.id = ?
|
||||||
INFO Engine [generated in 0.00029s] (1,)
|
INFO Engine [generated in 0.00029s] (1,)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero, heroteamlink
|
FROM hero, heroteamlink
|
||||||
WHERE ? = heroteamlink.team_id AND hero.id = heroteamlink.hero_id
|
WHERE ? = heroteamlink.team_id AND hero.id = heroteamlink.hero_id
|
||||||
INFO Engine [cached since 0.5625s ago] (1,)
|
INFO Engine [cached since 0.5625s ago] (1,)
|
||||||
|
|
||||||
@ -223,12 +223,12 @@ Reverted Z-Force's heroes: [
|
|||||||
]
|
]
|
||||||
|
|
||||||
// Automatically refresh the data while accessing the attribute .teams
|
// Automatically refresh the data while accessing the attribute .teams
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.4209s ago] (3,)
|
INFO Engine [cached since 0.4209s ago] (3,)
|
||||||
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
INFO Engine SELECT team.id AS team_id, team.name AS team_name, team.headquarters AS team_headquarters
|
||||||
FROM team, heroteamlink
|
FROM team, heroteamlink
|
||||||
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
WHERE ? = heroteamlink.hero_id AND team.id = heroteamlink.team_id
|
||||||
INFO Engine [cached since 0.5842s ago] (3,)
|
INFO Engine [cached since 0.5842s ago] (3,)
|
||||||
|
|
||||||
|
@ -86,8 +86,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// The SELECT with WHERE
|
// The SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.age <= ?
|
WHERE hero.age <= ?
|
||||||
INFO Engine [no key 0.00021s] (35,)
|
INFO Engine [no key 0.00021s] (35,)
|
||||||
|
|
||||||
@ -132,8 +132,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// The SELECT with WHERE
|
// The SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.age <= ?
|
WHERE hero.age <= ?
|
||||||
INFO Engine [no key 0.00021s] (35,)
|
INFO Engine [no key 0.00021s] (35,)
|
||||||
|
|
||||||
@ -180,8 +180,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// The SELECT with WHERE
|
// The SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00015s] ('Deadpond',)
|
INFO Engine [no key 0.00015s] ('Deadpond',)
|
||||||
|
|
||||||
@ -203,8 +203,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// The SELECT with WHERE
|
// The SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00015s] ('Deadpond',)
|
INFO Engine [no key 0.00015s] ('Deadpond',)
|
||||||
|
|
||||||
@ -274,8 +274,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// SELECT with WHERE
|
// SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.age < ?
|
WHERE hero.age < ?
|
||||||
INFO Engine [no key 0.00014s] (25,)
|
INFO Engine [no key 0.00014s] (25,)
|
||||||
|
|
||||||
@ -370,8 +370,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// SELECT with WHERE
|
// SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00021s] (1,)
|
INFO Engine [generated in 0.00021s] (1,)
|
||||||
|
|
||||||
@ -413,8 +413,8 @@ $ python app.py
|
|||||||
|
|
||||||
// SELECT with WHERE
|
// SELECT with WHERE
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00024s] (9001,)
|
INFO Engine [generated in 0.00024s] (9001,)
|
||||||
|
|
||||||
|
@ -144,10 +144,10 @@ But now, what happens when we print the `preventers_team.heroes`?
|
|||||||
|
|
||||||
``` hl_lines="3"
|
``` hl_lines="3"
|
||||||
Preventers Team Heroes again: [
|
Preventers Team Heroes again: [
|
||||||
Hero(name='Rusty-Man', age=48, id=2, secret_name='Tommy Sharp', team_id=2),
|
Hero(name='Rusty-Man', age=48, id=2, secret_name='Tommy Sharp', team_id=2),
|
||||||
Hero(name='Spider-Boy', age=None, id=3, secret_name='Pedro Parqueador', team_id=2, team=None),
|
Hero(name='Spider-Boy', age=None, id=3, secret_name='Pedro Parqueador', team_id=2, team=None),
|
||||||
Hero(name='Tarantula', age=32, id=6, secret_name='Natalia Roman-on', team_id=2),
|
Hero(name='Tarantula', age=32, id=6, secret_name='Natalia Roman-on', team_id=2),
|
||||||
Hero(name='Dr. Weird', age=36, id=7, secret_name='Steve Weird', team_id=2),
|
Hero(name='Dr. Weird', age=36, id=7, secret_name='Steve Weird', team_id=2),
|
||||||
Hero(name='Captain North America', age=93, id=8, secret_name='Esteban Rogelios', team_id=2)
|
Hero(name='Captain North America', age=93, id=8, secret_name='Esteban Rogelios', team_id=2)
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -182,15 +182,15 @@ Now, if we commit it and print again:
|
|||||||
When we access `preventers_team.heroes` after the `commit`, that triggers a refresh, so we get the latest list, without **Spider-Boy**, so that's fine again:
|
When we access `preventers_team.heroes` after the `commit`, that triggers a refresh, so we get the latest list, without **Spider-Boy**, so that's fine again:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age, hero.team_id AS hero_team_id
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age, hero.team_id AS hero_team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE ? = hero.team_id
|
WHERE ? = hero.team_id
|
||||||
2021-08-13 11:15:24,658 INFO sqlalchemy.engine.Engine [cached since 0.1924s ago] (2,)
|
2021-08-13 11:15:24,658 INFO sqlalchemy.engine.Engine [cached since 0.1924s ago] (2,)
|
||||||
|
|
||||||
Preventers Team Heroes after commit: [
|
Preventers Team Heroes after commit: [
|
||||||
Hero(name='Rusty-Man', age=48, id=2, secret_name='Tommy Sharp', team_id=2),
|
Hero(name='Rusty-Man', age=48, id=2, secret_name='Tommy Sharp', team_id=2),
|
||||||
Hero(name='Tarantula', age=32, id=6, secret_name='Natalia Roman-on', team_id=2),
|
Hero(name='Tarantula', age=32, id=6, secret_name='Natalia Roman-on', team_id=2),
|
||||||
Hero(name='Dr. Weird', age=36, id=7, secret_name='Steve Weird', team_id=2),
|
Hero(name='Dr. Weird', age=36, id=7, secret_name='Steve Weird', team_id=2),
|
||||||
Hero(name='Captain North America', age=93, id=8, secret_name='Esteban Rogelios', team_id=2)
|
Hero(name='Captain North America', age=93, id=8, secret_name='Esteban Rogelios', team_id=2)
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
@ -260,9 +260,9 @@ That second print would output:
|
|||||||
|
|
||||||
```
|
```
|
||||||
Preventers Team Heroes again: [
|
Preventers Team Heroes again: [
|
||||||
Hero(name='Rusty-Man', age=48, id=2, secret_name='Tommy Sharp', team_id=2),
|
Hero(name='Rusty-Man', age=48, id=2, secret_name='Tommy Sharp', team_id=2),
|
||||||
Hero(name='Tarantula', age=32, id=6, secret_name='Natalia Roman-on', team_id=2),
|
Hero(name='Tarantula', age=32, id=6, secret_name='Natalia Roman-on', team_id=2),
|
||||||
Hero(name='Dr. Weird', age=36, id=7, secret_name='Steve Weird', team_id=2),
|
Hero(name='Dr. Weird', age=36, id=7, secret_name='Steve Weird', team_id=2),
|
||||||
Hero(name='Captain North America', age=93, id=8, secret_name='Esteban Rogelios', team_id=2)
|
Hero(name='Captain North America', age=93, id=8, secret_name='Esteban Rogelios', team_id=2)
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
@ -111,8 +111,8 @@ That would print a list with all the heroes in the Preventers team:
|
|||||||
$ python app.py
|
$ python app.py
|
||||||
|
|
||||||
// Automatically fetch the heroes
|
// Automatically fetch the heroes
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age, hero.team_id AS hero_team_id
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age, hero.team_id AS hero_team_id
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE ? = hero.team_id
|
WHERE ? = hero.team_id
|
||||||
INFO Engine [cached since 0.8774s ago] (2,)
|
INFO Engine [cached since 0.8774s ago] (2,)
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ This `session.exec(statement)` will generate this output:
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
INFO Engine [no key 0.00032s] ()
|
INFO Engine [no key 0.00032s] ()
|
||||||
```
|
```
|
||||||
@ -455,7 +455,7 @@ In this chapter we are touching some of them.
|
|||||||
|
|
||||||
### SQLModel's `select`
|
### SQLModel's `select`
|
||||||
|
|
||||||
When importing from `sqlmodel` the `select()` function, you are using **SQLModel**'s version of `select`.
|
When importing from `sqlmodel` the `select()` function, you are using **SQLModel**'s version of `select`.
|
||||||
|
|
||||||
SQLAchemy also has it's own `select`, and SQLModel's `select` uses SQLAlchemy's `select` internally.
|
SQLAchemy also has it's own `select`, and SQLModel's `select` uses SQLAlchemy's `select` internally.
|
||||||
|
|
||||||
|
@ -132,8 +132,8 @@ $ python app.py
|
|||||||
// Some boilerplate and previous output omitted 😉
|
// Some boilerplate and previous output omitted 😉
|
||||||
|
|
||||||
// The SELECT with WHERE
|
// The SELECT with WHERE
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00017s] ('Spider-Boy',)
|
INFO Engine [no key 0.00017s] ('Spider-Boy',)
|
||||||
|
|
||||||
@ -275,8 +275,8 @@ $ python app.py
|
|||||||
// Previous output omitted 🙈
|
// Previous output omitted 🙈
|
||||||
|
|
||||||
// The SQL to SELECT the fresh hero data
|
// The SQL to SELECT the fresh hero data
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00018s] (2,)
|
INFO Engine [generated in 0.00018s] (2,)
|
||||||
```
|
```
|
||||||
|
@ -490,8 +490,8 @@ $ python app.py
|
|||||||
|
|
||||||
// Now the important part, the SELECT with WHERE 💡
|
// Now the important part, the SELECT with WHERE 💡
|
||||||
|
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00014s] ('Deadpond',)
|
INFO Engine [no key 0.00014s] ('Deadpond',)
|
||||||
|
|
||||||
@ -726,8 +726,8 @@ This will select the rows `WHERE` the `age` is **greater than or equal** to `35`
|
|||||||
The equivalent SQL would be:
|
The equivalent SQL would be:
|
||||||
|
|
||||||
```SQL hl_lines="3"
|
```SQL hl_lines="3"
|
||||||
SELECT id, name, secret_name, age
|
SELECT id, name, secret_name, age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE age >= 35 AND age < 40
|
WHERE age >= 35 AND age < 40
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -743,8 +743,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// The SELECT statement with WHERE, also using AND
|
// The SELECT statement with WHERE, also using AND
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.age >= ? AND hero.age < ?
|
WHERE hero.age >= ? AND hero.age < ?
|
||||||
INFO Engine [no key 0.00014s] (35, 40)
|
INFO Engine [no key 0.00014s] (35, 40)
|
||||||
|
|
||||||
@ -838,8 +838,8 @@ $ python app.py
|
|||||||
// Some boilerplate output omitted 😉
|
// Some boilerplate output omitted 😉
|
||||||
|
|
||||||
// The SELECT statement with WHERE, also using OR 🔍
|
// The SELECT statement with WHERE, also using OR 🔍
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.age <= ? OR hero.age > ?
|
WHERE hero.age <= ? OR hero.age > ?
|
||||||
INFO Engine [no key 0.00021s] (35, 90)
|
INFO Engine [no key 0.00021s] (35, 90)
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00017s] (1,)
|
INFO Engine [generated in 0.00017s] (1,)
|
||||||
|
|
||||||
@ -196,8 +196,8 @@
|
|||||||
Generates the output:
|
Generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001245s ago] (2,)
|
INFO Engine [cached since 0.001245s ago] (2,)
|
||||||
|
|
||||||
@ -211,8 +211,8 @@
|
|||||||
Generates the output:
|
Generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
INFO Engine SELECT hero.id AS hero_id, hero.name AS hero_name, hero.secret_name AS hero_secret_name, hero.age AS hero_age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002215s ago] (3,)
|
INFO Engine [cached since 0.002215s ago] (3,)
|
||||||
|
|
||||||
@ -265,8 +265,8 @@
|
|||||||
Generates the output:
|
Generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00024s] (1,)
|
INFO Engine [generated in 0.00024s] (1,)
|
||||||
```
|
```
|
||||||
@ -278,8 +278,8 @@
|
|||||||
Generates the output:
|
Generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001487s ago] (2,)
|
INFO Engine [cached since 0.001487s ago] (2,)
|
||||||
```
|
```
|
||||||
@ -291,8 +291,8 @@
|
|||||||
Generates the output:
|
Generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.002377s ago] (3,)
|
INFO Engine [cached since 0.002377s ago] (3,)
|
||||||
```
|
```
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00011s] ('Spider-Youngster',)
|
INFO Engine [no key 0.00011s] ('Spider-Youngster',)
|
||||||
```
|
```
|
||||||
@ -65,8 +65,8 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00013s] ('Spider-Youngster',)
|
INFO Engine [no key 0.00013s] ('Spider-Youngster',)
|
||||||
```
|
```
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
INFO Engine [no key 0.00032s] ()
|
INFO Engine [no key 0.00032s] ()
|
||||||
```
|
```
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
This generates the output:
|
This generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00017s] ('Spider-Boy',)
|
INFO Engine [no key 0.00017s] ('Spider-Boy',)
|
||||||
```
|
```
|
||||||
@ -53,8 +53,8 @@
|
|||||||
This generates the output:
|
This generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00018s] (2,)
|
INFO Engine [generated in 0.00018s] (2,)
|
||||||
```
|
```
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
This generates the output:
|
This generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00018s] ('Spider-Boy',)
|
INFO Engine [no key 0.00018s] ('Spider-Boy',)
|
||||||
```
|
```
|
||||||
@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.name = ?
|
WHERE hero.name = ?
|
||||||
INFO Engine [no key 0.00020s] ('Captain North America',)
|
INFO Engine [no key 0.00020s] ('Captain North America',)
|
||||||
```
|
```
|
||||||
@ -109,8 +109,8 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine BEGIN (implicit)
|
INFO Engine BEGIN (implicit)
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [generated in 0.00023s] (2,)
|
INFO Engine [generated in 0.00023s] (2,)
|
||||||
```
|
```
|
||||||
@ -123,8 +123,8 @@
|
|||||||
This generates the output:
|
This generates the output:
|
||||||
|
|
||||||
```
|
```
|
||||||
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
INFO Engine SELECT hero.id, hero.name, hero.secret_name, hero.age
|
||||||
FROM hero
|
FROM hero
|
||||||
WHERE hero.id = ?
|
WHERE hero.id = ?
|
||||||
INFO Engine [cached since 0.001709s ago] (7,)
|
INFO Engine [cached since 0.001709s ago] (7,)
|
||||||
```
|
```
|
||||||
|
@ -8,7 +8,6 @@ from sqlalchemy.sql.type_api import TypeEngine
|
|||||||
|
|
||||||
|
|
||||||
class AutoString(types.TypeDecorator): # type: ignore
|
class AutoString(types.TypeDecorator): # type: ignore
|
||||||
|
|
||||||
impl = types.String
|
impl = types.String
|
||||||
cache_ok = True
|
cache_ok = True
|
||||||
mysql_default_length = 255
|
mysql_default_length = 255
|
||||||
|
@ -261,7 +261,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -184,7 +184,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -123,7 +123,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -123,7 +123,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -155,7 +155,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -111,7 +111,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
response = client.post("/heroes/", json=hero_data)
|
response = client.post("/heroes/", json=hero_data)
|
||||||
data = response.json()
|
data = response.json()
|
||||||
|
@ -261,7 +261,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -99,7 +99,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -474,7 +474,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|
@ -233,7 +233,6 @@ def test_tutorial(clear_sqlmodel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
with TestClient(mod.app) as client:
|
with TestClient(mod.app) as client:
|
||||||
|
|
||||||
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
hero1_data = {"name": "Deadpond", "secret_name": "Dive Wilson"}
|
||||||
hero2_data = {
|
hero2_data = {
|
||||||
"name": "Spider-Boy",
|
"name": "Spider-Boy",
|
||||||
|