Returning all columns except two

3 views
Skip to first unread message

Desmond Lim

unread,
Jun 3, 2019, 8:29:38 PM6/3/19
to sqlalchemy
Hi All,

I have a question which I think I know the answer to but I'd like to confirm.

I have a table/model that when I return the objects or list of objects, I want all the columns (15 of them) to be returned except 2. Is there a way to do that? Currently, I'm doing this (as per documentation)

session.query(User).options(load_only("first_name", "last_name", ......)) 

for all my queries and it is rather tedious and just makes the codes look ugly.

Is there a command that I can use for all queries that would return all by 2 columns unless I tell it not to?

Thanks.
Desmond



Mike Bayer

unread,
Jun 3, 2019, 9:25:00 PM6/3/19
to sqlal...@googlegroups.com
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
 
 
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 sqlalchemy+...@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages