SQL
Module: implementation.datasources.db
SQLAction
SQL action without returns. Expected that this action will execute statements that don't return data from DB.
Subclass of Action. Type of Action[Dict[str, Any], None]
__init__
Arguments:
session (SQLSessionFactory): Session to use.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
execute
Arguments:
input_data (Dict[str, Any]): Expected keys:
"statement" (Any): SQLAlchemy statement.
"kwargs" (Dict[str, Any], optional): Extra arguments.
In details about statements, see:
SQLActionWithReturns
SQL action with returns. Subclass of Action. Type of Action[Dict[str, Any], Any]
__init__
Arguments:
session (SQLSessionFactory): Session to use.
name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.
execute
Arguments:
input_data (Dict[str, Any]): Expected keys:
"statement" (Any): SQLAlchemy statement.
"kwargs" (Dict[str, Any], optional): Extra arguments.
Returns:
List[Any]: Result of query.
In details about statements, see:
SQLSessionFactory
Sessions manager
__init__
Arguments:
url (str): connection URL of the DB.
echo (bool, optional): If equals to True, logs debug info. Defaults to False.
create
Create session
Returns:
Session
close_all
Close all sessions
create_tables
Create all tables
Arguments:
tables_class (Type[DeclarativeBase], optional): Base class of tables that will be used to trigger creation. Defaults to BaseModel.
See more:
BaseModel
Default base class for tables models. Subclass of DeclarativeBase.
Last updated