Skip to content

Commit 542b453

Browse files
committed
Update comment.
1 parent 6d65226 commit 542b453

1 file changed

Lines changed: 31 additions & 2 deletions

File tree

tests/test_qblike_3.py

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"""
3535
An example of a SQL-Alchemy like ORM.
3636
37-
The User and Post classes model a SQLite schema:
37+
The User, Post, and Comment classes model a SQLite schema:
3838
```
3939
CREATE TABLE users (
4040
id INTEGER PRIMARY KEY AUTOINCREMENT,
@@ -61,7 +61,36 @@
6161
);
6262
```
6363
64-
Protocols are generated using AddInit[T], Create[T], and Update[T].
64+
Users can query using the `select` function, which generates a `Query` object
65+
with the specified tables and fields.
66+
67+
Users can then execute the query using `Session.execute`, which returns a
68+
list of `QueryRow` objects.
69+
70+
If a single table is selected, the `QueryRow` object will contain the selected
71+
fields.
72+
73+
For example, `select(User.name)` will return a list of:
74+
75+
class QueryRow[...]:
76+
name: str
77+
78+
If multiple tables are selected, the `QueryRow` object will contain a field for
79+
each table, which in turn contains the selected fields.
80+
81+
For example, `select(User.name, Post.content)` will return a list of:
82+
83+
class QueryRow[...]:
84+
User: Select[User, tuple[...]]]:
85+
Post: Select[Post, tuple[...]]]:
86+
87+
where,
88+
89+
class Select[User, tuple[...]]:
90+
name: str
91+
92+
class Select[Post, tuple[...]]:
93+
content: str
6594
"""
6695

6796

0 commit comments

Comments
 (0)