Autoloading only certain columns
Issue #561
resolved
A Table option to autoload only certain columns would be useful. This would allow selects, updates, and mapper classes to avoid loading large or numerous fields that the caller will never access. It can be implemented as a constructor arg listing the desired column names:
my_table = Table("Foo", meta, autoload_columns=["first_name", "last_name"]("meta_id",))
This proposal is simpler and more straightforward than the alternatives:
- Not autoloading. That requires one to hardcode the column types, which is bad if the table is admin'd externally.
- Calling .noload() on mapped objects. It's better to list desired columns rather than undesired ones, especially since you may not know all the undesired columns that exist now or may be added in the future.
- Table.select() can't choose a subset of columns, forcing one to use the less convenient select() function instead.
- SQL queries have .append_column() but no corresponding .remove_column().
Comments (4)
-
repo owner -
repo owner - changed milestone to 0.4.0
-
repo owner - changed status to resolved
jbellis implemented in changeset:3044, I changed the interface to be more explicit and added a unit test in changeset:3052.
-
repo owner - removed milestone
Removing milestone: 0.4.0 (automated comment)
- Log in to comment