SQL Functions
Contents
SQL Functions#
Red Bird’s SQL functions are functional tools
to perform simple SQL operations. They provide
functional alternative to redbird.sql.Table.
They simply create an instance of the class and
call its methods.
Basic Operations#
- redbird.sql.select(*args, bind, table=None, **kwargs)#
Read rows from a table in a SQL database.
- Parameters
engine (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to use.
*args – Passed to
redbird.sql.Table.select()**kwargs – Passed to
redbird.sql.Table.select()
- redbird.sql.insert(*args, bind, table=None, **kwargs)#
Insert row(s) to a table in a SQL database.
- Parameters
bind (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to use.
*args – Passed to
redbird.sql.Table.insert()**kwargs – Passed to
redbird.sql.Table.insert()
- redbird.sql.update(*args, bind, table=None, **kwargs)#
Update row(s) to a table in a SQL database.
- Parameters
bind (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to use.
*args – Passed to
redbird.sql.Table.update()**kwargs – Passed to
redbird.sql.Table.update()
- redbird.sql.delete(*args, bind, table=None, **kwargs)#
Delete row(s) in a table in a SQL database.
- Parameters
bind (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to use.
*args – Passed to
redbird.sql.Table.delete()**kwargs – Passed to
redbird.sql.Table.delete()
Additional Functions#
- redbird.sql.execute(*args, bind, **kwargs)#
Execute raw SQL or a SQL expression in a SQL database.
- Parameters
bind (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to use.
*args – Passed to
redbird.sql.Table.execute()**kwargs – Passed to
redbird.sql.Table.execute()
- redbird.sql.create_table(*args, bind, table, **kwargs)#
Create a table to a SQL database.
- Parameters
bind (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to be created.
*args – Passed to
redbird.sql.Table.create()**kwargs – Passed to
redbird.sql.Table.create()
- redbird.sql.count(*args, bind, table=None, **kwargs)#
Count the number of rows in a table in a SQL database.
- Parameters
bind (sqlalchemy.engine.Engine) – SQLAlchemy engine for the connection
table (str) – Name of the table to use.
*args – Passed to
redbird.sql.Table.count()**kwargs – Passed to
redbird.sql.Table.count()