Hi,

I'm a bit confused about the scalars() in 1.4+. The "ORM Querying Guide"
introduces it in the very first example, but it says:
"When selecting a list of single-column ORM entities, it is typical to skip
the generation of Row objects and instead receive ORM entities directly,
which is achieved using the Result.scalars() method."
https://docs.sqlalchemy.org/en/14/orm/queryguide.html#select-statements

The confusing part for me is the usage of single-column. The listed query
is:
session.execute(select(User).order_by(User.id))
or
SELECT user_account.id, user_account.name, user_account.fullname
FROM user_account ORDER BY user_account.id

This is clearly not a single column SQL query. I see that the docs say:
"single-column ORM entities" but this is quite a puzzling thing to read for
me, coming from pre-1.4 background (I've used both ORM and Core for years).

I always think of the ORM as something which is returning objects possibly
with some columns lazy-loaded. But now the whole object is a "ORM column"?

I'm not suggesting any change to the code, just the documentation is
confusing for me.

Regards,
Zsolt

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/CAKw-smDpHq2K31R%2B1txs-n8kH0_uyC0YfZJf44VKLCsSSFxEwg%40mail.gmail.com.

Reply via email to