Rows, Not Objects
Select columns, and each result is a Row, which works like a named tuple:
for row in session.exec(statement):
print(row.last_name, row.logins)
name, count = row
Select a class, and each result is an object:
session.exec(select(Person))
session.exec(select(Person.last_name))
session.exec(select(Person, logins))
.label("logins") is what gives the column its name in the row
- Return type hints say which:
list[Person] or list[tuple[str, int]]