Produce an ascending ``ORDER BY`` clause element. e.g.:: from sqlalchemy import asc stmt = select(users_table).order_by(asc(users_table.c.name)) will produce SQL as: .. sourcecode:: sql SELECT id, name FROM user ORDER BY name ASC The :func:`.asc` functi
(
column: _ColumnExpressionOrStrLabelArgument[_T],
)
| 310 | |
| 311 | |
| 312 | def asc( |
| 313 | column: _ColumnExpressionOrStrLabelArgument[_T], |
| 314 | ) -> UnaryExpression[_T]: |
| 315 | """Produce an ascending ``ORDER BY`` clause element. |
| 316 | |
| 317 | e.g.:: |
| 318 | |
| 319 | from sqlalchemy import asc |
| 320 | |
| 321 | stmt = select(users_table).order_by(asc(users_table.c.name)) |
| 322 | |
| 323 | will produce SQL as: |
| 324 | |
| 325 | .. sourcecode:: sql |
| 326 | |
| 327 | SELECT id, name FROM user ORDER BY name ASC |
| 328 | |
| 329 | The :func:`.asc` function is a standalone version of the |
| 330 | :meth:`_expression.ColumnElement.asc` |
| 331 | method available on all SQL expressions, |
| 332 | e.g.:: |
| 333 | |
| 334 | |
| 335 | stmt = select(users_table).order_by(users_table.c.name.asc()) |
| 336 | |
| 337 | :param column: A :class:`_expression.ColumnElement` (e.g. |
| 338 | scalar SQL expression) |
| 339 | with which to apply the :func:`.asc` operation. |
| 340 | |
| 341 | .. seealso:: |
| 342 | |
| 343 | :func:`.desc` |
| 344 | |
| 345 | :func:`.nulls_first` |
| 346 | |
| 347 | :func:`.nulls_last` |
| 348 | |
| 349 | :meth:`_expression.Select.order_by` |
| 350 | |
| 351 | """ |
| 352 | return UnaryExpression._create_asc(column) |
| 353 | |
| 354 | |
| 355 | def collate( |