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 Common errors
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'}). Warnings
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`.
Imports
- ABSQLEngine
from absql import ABSQLEngine - render
from absql import render - render_file
from absql import render_file
Quickstart
from absql import ABSQLEngine
engine = ABSQLEngine()
template = """
---
db: postgresql
---
SELECT * FROM {{ table_name }}
"""
result = engine.render(template, table_name='users')
print(result)