Skip to content

Allow opt-in inclusion of non-default-selected computed SQL properties in find*() #3252

Description

@bpamiri

Requested by Ben Nadel in discussion #1634. A contributor signalled intent to implement in Jan 2026 but no tracking issue was ever filed — opening one so the idea isn't lost.

The gap

Wheels already supports excluding a computed property from the default SELECT:

property(name="fullName", sql="firstName || ' ' || lastName", select=false);

…honored at vendor/wheels/model/sql.cfc (if (local.classData.calculatedProperties[local.key].select)). But there is currently no per-call way to pull that property back in on a specific finder short of spelling out the entire select clause by hand. include= is association-only (vendor/wheels/model/read.cfc — "Associations that should be included in the query using INNER or LEFT OUTER joins"); there is no sql:/sqlProperties path (grep confirms neither exists).

So a property defined as select=false (to keep it off the hot path) can only be retrieved by manually listing every column you want — which defeats the convenience the property(sql=...) helper otherwise gives you.

Suggested API (from the discussion)

// Ben's suggestion — opt a single computed property into one finder:
model("User").findAll(include="sql:fullName");
// or a dedicated argument:
model("User").findAll(sqlProperties="fullName,ageInYears");

Scope notes

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions