| 288 | @properties.ColumnProperty.strategy_for(query_expression=True) |
| 289 | class ExpressionColumnLoader(ColumnLoader): |
| 290 | def __init__(self, parent, strategy_key): |
| 291 | super().__init__(parent, strategy_key) |
| 292 | |
| 293 | # compare to the "default" expression that is mapped in |
| 294 | # the column. If it's sql.null, we don't need to render |
| 295 | # unless an expr is passed in the options. |
| 296 | null = sql.null().label(None) |
| 297 | self._have_default_expression = any( |
| 298 | not c.compare(null) for c in self.parent_property.columns |
| 299 | ) |
| 300 | |
| 301 | def setup_query( |
| 302 | self, |