SQLAlchemy Core – func Function

It is an object in SQLAlchemy that serves as a namespace for SQL functions.

Syntax: func.function_name(column).

Parameters:

  • func: It is an object in SQLAlchemy that serves as a namespace for SQL functions.
  • function_name(): Which represents the SQL function EX: avg, count, sum, max, min…
  • column: Represents a column of table in Database.

Return: returns a SQL Expression which represents the SQL function call with specified column.

For our examples, we have already created a Student table which we will be using:

Students Table

SQLAlchemy Core – Functions

SQLAlchemy provides a rich set of functions that can be used in SQL expressions to perform various operations and calculations on the data. SQLAlchemy provides the Function API to work with the SQL functions in a more flexible manner. The Function API is used to construct SQL expressions representing function calls and can be applied to columns. SQL functions are invoked by using the func namespace.

Prerequisites

Similar Reads

SQLAlchemy Core – func Function

It is an object in SQLAlchemy that serves as a namespace for SQL functions....

SQLAlchemy Mathematical Functions

Python sqlalchemy func.avg(column)...

SQLAlchemy Core – String Functions

...

SQLAlchemy Core – Date and Time Functions

...

SQLAlchemy Core – Other Functions

...