ralsei.jinja.environment
¶
Module Contents¶
Classes¶
Represents an imported template (see |
|
Compiled jinja template that can be rendered |
|
Type-aware jinja environment for rendering SQL |
API¶
-
class ralsei.jinja.environment.SqlTemplateModule(template: jinja2.environment.Template, context: jinja2.runtime.Context, body_stream: collections.abc.Iterable[str] | None =
None
)¶ Bases:
jinja2.environment.TemplateModule
Represents an imported template (see
jinja2.Template.module
)All the exported names of the template are available as attributes on this object.
Initialization
- render_sql() sqlalchemy.sql.elements.TextClause ¶
Render and wrap with
sqlalchemy.sql.expression.text()
- render_sql_split() list[sqlalchemy.sql.elements.TextClause] ¶
Render as multiple statements, splitting on
{%split%}
tag, wrap withsqlalchemy.sql.expression.text()
- class ralsei.jinja.environment.SqlTemplate¶
Bases:
jinja2.Template
Compiled jinja template that can be rendered
- render_sql(*args: Any, **kwargs: Any) sqlalchemy.sql.elements.TextClause ¶
Render and wrap in
sqlalchemy.sql.expression.text()
- render_split(*args: Any, **kwargs: Any) list[str] ¶
Render as multiple statements, splitting on
{%split%}
tag
- render_sql_split(*args: Any, **kwargs: Any) list[sqlalchemy.sql.elements.TextClause] ¶
Render as multiple statements, splitting on
{%split%}
tag, wrap insqlalchemy.sql.expression.text()
-
class ralsei.jinja.environment.SqlEnvironment(dialect_info: ralsei.dialect.DialectInfo =
BaseDialectInfo
)¶ Bases:
jinja2.Environment
Type-aware jinja environment for rendering SQL
- Parameters:¶
- dialect_info: ralsei.dialect.DialectInfo =
BaseDialectInfo
¶ dialect-specific settings
- dialect_info: ralsei.dialect.DialectInfo =
Initialization
- property adapter : ralsei.jinja.adapter.SqlAdapter¶
Type adapter that turns values in braces (like
{{value}}
) into SQL strings
- property dialect_info : ralsei.dialect.DialectInfo¶
Dialect-specific settings
-
from_string(source: str | jinja2.nodes.Template, globals: collections.abc.MutableMapping[str, Any] | None =
None
, template_class: type[jinja2.Template] | None =None
) jinja2.Template ¶ See
jinja2.Environment.from_string()
By default, the template class will be
SqlTemplate
- render(source: str, /, *args: Any, **kwargs: Any) str ¶
Render template once, shorthand for
self.from_string().render()
- render_sql(source: str, /, *args: Any, **kwargs: Any) sqlalchemy.sql.elements.TextClause ¶
Render and wrap with
sqlalchemy.sql.expression.text()
- render_split(source: str, /, *args: Any, **kwargs: Any) list[str] ¶
Render as multiple statements, splitting on
{%split%}
tag
- render_sql_split(source: str, /, *args: Any, **kwargs: Any) list[sqlalchemy.sql.elements.TextClause] ¶
Render as multiple statements, splitting on
{%split%}
tag, wrap withsqlalchemy.sql.expression.text()
- property base : ralsei.jinja.environment.SqlEnvironment¶