Skip to content

Sql

This module contains the base class for SQL steps.

koheesio.models.sql.SqlBaseStep #

Base class for SQL steps

params are used as placeholders for templating. The substitutions are identified by braces ('{' and '}') and can optionally contain a $-sign - e.g. ${placeholder} or {placeholder}.

Parameters:

Name Type Description Default
sql_path Optional[Union[Path, str]]

Path to a SQL file

None
sql Optional[str]

SQL script to apply

None
params Dict[str, Any], optional, default_factory=dict

Placeholders (parameters) for templating. These are identified with ${placeholder} in the SQL script.

Note: any arbitrary kwargs passed to the class will be added to params.

required

params class-attribute instance-attribute #

params: Dict[str, Any] = Field(
    default_factory=dict,
    description="Placeholders (parameters) for templating. The substitutions are identified by braces ('{' and '}')and can optionally contain a $-sign. Note: any arbitrary kwargs passed to the class will be added to params.",
)

query property #

query: str

Returns the query while performing params replacement

sql class-attribute instance-attribute #

sql: Optional[str] = Field(
    default=None, description="SQL script to apply"
)

sql_path class-attribute instance-attribute #

sql_path: Optional[Union[Path, str]] = Field(
    default=None, description="Path to a SQL file"
)