MCPcopy Create free account
hub / github.com/sqlalchemy/sqlalchemy / asc

Function asc

lib/sqlalchemy/sql/_elements_constructors.py:312–352  ·  view source on GitHub ↗

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],
)

Source from the content-addressed store, hash-verified

310
311
312def 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
355def collate(

Callers 8

test_order_by_nullsMethod · 0.90
test_orderby_groupbyMethod · 0.90
test_ascMethod · 0.90
test_issue_5470_twoMethod · 0.90
test_issue_5470_threeMethod · 0.90
test_issue_5470_fourMethod · 0.90

Calls 1

_create_ascMethod · 0.80

Tested by 7

test_order_by_nullsMethod · 0.72
test_orderby_groupbyMethod · 0.72
test_ascMethod · 0.72
test_issue_5470_twoMethod · 0.72
test_issue_5470_threeMethod · 0.72
test_issue_5470_fourMethod · 0.72