SQL and Generic Functions

SQL functions are invoked by using the func namespace. See the tutorial at Working with SQL Functions for background on how to use the func object to render SQL functions in statements.

Function API

The base API for SQL functions, which provides for the func namespace as well as classes that may be used for extensibility.

Selected “Known” Functions

These are GenericFunction implementations for a selected set of common SQL functions that set up the expected return type for each function automatically. The are invoked in the same way as any other member of the func namespace:

select(func.count("*")).select_from(some_table)

Note that any name not known to func generates the function name as is - there is no restriction on what SQL functions can be called, known or unknown to SQLAlchemy, built-in or user defined. The section here only describes those functions where SQLAlchemy already knows what argument and return types are in use.

Back to Top