ABSQL

raw JSON →
0.6.3 verified Sat May 09 auth: no python

A rendering engine for templated SQL. Current version 0.6.3, with occasional releases. Supports Jinja-like templating, YAML frontmatter, and multiple file types.

pip install absql
error ModuleNotFoundError: No module named 'frontmatter'
cause Missing dependency for YAML frontmatter parsing.
fix
Install absql with YAML support: pip install absql[yaml] or install PyYAML separately.
error AttributeError: 'str' object has no attribute 'items'
cause Passing a string as context instead of a dictionary.
fix
Always pass context as a dictionary: engine.render(template, {'key': 'value'}).
breaking In v0.6.0, when `return_dict=True`, the key for file-specific content changed to `absql_body` instead of the filename.
fix If you relied on the old key (e.g., `result['sql']`), update to `result['absql_body']`.
gotcha The `flatdict` package dependency was removed in v0.6.3. If you used `flatdict` directly in your code, it will break.
fix Install `flatdict` separately if needed: `pip install flatdict`.

Define a template with YAML frontmatter and render with context variables.

from absql import ABSQLEngine

engine = ABSQLEngine()
template = """
---
db: postgresql
---
SELECT * FROM {{ table_name }}
"""
result = engine.render(template, table_name='users')
print(result)