Toolchain Module¶
Toolchain step definitions.
This module defines the building blocks of a toolchain, where each step wraps a driver or processor (internal language driver, connection driver, or simplifier) and provides both synchronous and asynchronous execution methods with integrated logging for start, success, and error events.
- Step:
Base class for toolchain steps that resolves the underlying driver.
- ILStep:
Wraps an internal language driver for parsing input into SQL dialects.
- ConnectionStep:
Wraps a connection driver for executing SQL statements.
- SimplifierStep:
Wraps a simplifier for post-processing and simplifying results.
- class plugorm.toolchain.ConnectionStep(connection_driver: ConnectionDriver, logger: Logger)[source]¶
Step wrapping a connection driver in a toolchain.
Provides synchronous and asynchronous execution methods, with integrated logging for start, success, and error events.
- connection_driver¶
The connection driver wrapped by this step.
- Type:
- logger¶
Logger instance for logging step events.
- Type:
logging.Logger
- async astep(input_: str) Any[source]¶
Asynchronously executes a statement using the connection driver.
Logs the start, success, or failure of the execution.
- Parameters:
input (str) – The SQL statement or command to execute.
- Returns:
The result of executing the statement.
- Return type:
Any
- Raises:
ExecutionError – If the connection driver fails to execute the statement asynchronously.
- step(input_: str) Any[source]¶
Synchronously executes a statement using the connection driver.
Logs the start, success, or failure of the execution.
- Parameters:
input (str) – The SQL statement or command to execute.
- Returns:
The result of executing the statement.
- Return type:
Any
- Raises:
ExecutionError – If the connection driver fails to execute the statement.
- class plugorm.toolchain.ILStep(il_driver: ILDriver, logger: Logger)[source]¶
Step wrapping an internal language (IL) driver in a toolchain.
Provides synchronous and asynchronous parsing methods with integrated logging for start, success, and error events.
- logger¶
Logger instance for logging step events.
- Type:
logging.Logger
- async astep(input_: Any) str[source]¶
Asynchronously parses input using the internal language driver.
Logs the start, success, or failure of the parsing operation.
- Parameters:
input (Any) – The input data to parse.
- Returns:
The parsed internal language representation.
- Return type:
str
- Raises:
ILParsingError – If the internal language driver fails to parse the input asynchronously.
- step(input_: Any) str[source]¶
Synchronously parses input using the internal language driver.
Logs the start, success, or failure of the parsing operation.
- Parameters:
input (Any) – The input data to parse.
- Returns:
The parsed internal language representation.
- Return type:
str
- Raises:
ILParsingError – If the internal language driver fails to parse the input.
- class plugorm.toolchain.SimplifierStep(simplifier: Simplifier, logger: Logger)[source]¶
Step wrapping a simplifier in a toolchain.
Provides synchronous and asynchronous simplification methods, with integrated logging for start, success, and error events.
- simplifier¶
The simplifier wrapped by this step.
- Type:
- logger¶
Logger instance for logging step events.
- Type:
logging.Logger
- async astep(input_: Any) Any[source]¶
Asynchronously simplifies input using the simplifier.
Logs the start, success, or failure of the simplification operation.
- Parameters:
input (Any) – The input data to simplify.
- Returns:
The simplified output.
- Return type:
Any
- Raises:
SimplifyingError – If the simplifier fails to process the input asynchronously.
- step(input_: Any) Any[source]¶
Synchronously simplifies input using the simplifier.
Logs the start, success, or failure of the simplification operation.
- Parameters:
input (Any) – The input data to simplify.
- Returns:
The simplified output.
- Return type:
Any
- Raises:
SimplifyingError – If the simplifier fails to process the input.
- class plugorm.toolchain.Step[source]¶
Represents a single step in a driver toolchain.
Each Step wraps a driver component (internal language driver, connection driver, or simplifier) and provides access to the underlying driver instance for execution.
- get_driver() None[source]¶
Retrieves the associated driver for this step.
Cycles through possible names for the driver to retrieve the associated driver for this step.
- Returns:
- The driver instance linked to this step. Selection order is: il_driver, then connection_driver, then
simplifier.
- Return type: