Skip to content

Prevent fetching column when it is marked as #[sea-orm(skip)] #2698

@anshap1719

Description

@anshap1719

Motivation

This relates to #1954. I always assumed (and that's my bad) that marking a column as skip would not only use a default value for it (this works), but also not fetch it from the DB since the value is fetched and then thrown away (this doesn't work).

Since the original implementation had no mention of the latter, I am wondering if this is an intentional design choice. If yes, I'd like to know if you'd prefer a different attribute for skipping column fetch from DB.

Proposed Solutions

The current implementation dictates that all fields in the generated Column enum are selected by default when fetching data from DB.

In an ideal situation, the skipped columns shouldn't be fetched. It remains to be seen if they should be skipped unconditionally, or only by default–meaning they will be fetched if manually requested.

If we're not skipping the fetching of data part, then I'm not sure why the skip attribute exists at all. It sounds very misleading, but that's just a personal experience.

Additional Information

I'd be happy to create a PR for whichever way we decide to go with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions