feat: add withoutGeneratedColumns() to exclude auto-generated columns #266

Closed
ukeloop wants to merge 1 commit from feature/without-generated-columns into main
ukeloop commented 2026-04-15 16:05:35 +00:00 (Migrated from github.com)

Summary

This PR introduces a new method withoutGeneratedColumns() to the WithColumns concern. It allows developers to explicitly disable automatically generated columns when exporting data.

Motivation

Currently, when using ->fromTable() or similar helpers, columns may be auto-generated based on the table definition or model attributes. While methods like ->only() and ->except() exist, they still operate on the final resolved column set, which may include implicitly generated columns.

There is no straightforward way to completely opt out of generated columns and rely solely on manually defined columns via ->withColumns() .

This leads to:

  • Unexpected extra columns in exports
  • Additional filtering logic using except([]) or only([])
  • Reduced clarity in intent
## Summary This PR introduces a new method `withoutGeneratedColumns()` to the `WithColumns` concern. It allows developers to explicitly disable automatically generated columns when exporting data. ## Motivation Currently, when using `->fromTable()` or similar helpers, columns may be auto-generated based on the table definition or model attributes. While methods like `->only()` and `->except()` exist, they still operate on the final resolved column set, which may include implicitly generated columns. There is no straightforward way to completely opt out of generated columns and rely solely on manually defined columns via `->withColumns()` . This leads to: - Unexpected extra columns in exports - Additional filtering logic using `except([])` or `only([])` - Reduced clarity in intent
pxlrbt commented 2026-04-16 09:46:38 +00:00 (Migrated from github.com)

Hey,

thanks for the PR, but I don't really understand what you are trying to do. Those helpers are there to add those columns automatically. It doesn't really make sense to apply them and then remove the columns again. Why don't you just use it without the helper?

I know, the default has ->fromTable() applied, but it's not too hard to overwrite. I'd rather document it more clearly, than add another method.

Best,
Dennis

Hey, thanks for the PR, but I don't really understand what you are trying to do. Those helpers are there to add those columns automatically. It doesn't really make sense to apply them and then remove the columns again. Why don't you just use it without the helper? I know, the default has `->fromTable()` applied, but it's not too hard to overwrite. I'd rather document it more clearly, than add another method. Best, Dennis
ukeloop commented 2026-04-17 14:44:12 +00:00 (Migrated from github.com)

I’m so sorry.
I misunderstood.
I thought fromTable was a method for configuring the resource.


I’ve learned that when referencing a table’s resource, it’s sufficient to just use ExportBulkAction.

I apologize for taking up your valuable time.

I’m so sorry.
I misunderstood.
I thought `fromTable` was a method for configuring the resource. 
 I’ve learned that when referencing a table’s resource, it’s sufficient to just use `ExportBulkAction`. I apologize for taking up your valuable time.
pxlrbt commented 2026-04-17 15:58:40 +00:00 (Migrated from github.com)

->fromTable() does two things: Apply the table query and configure the columns. If you only want the first you can do it via ->useTableQuery().

Thanks for the time to open a PR anyway!

`->fromTable()` does two things: Apply the table query and configure the columns. If you only want the first you can do it via `->useTableQuery()`. Thanks for the time to open a PR anyway!

Pull request closed

Sign in to join this conversation.
No description provided.