#288 — Create a test notebook and polish SQL jinja templates for the transactions table

Repo: Twill-AI/twill-llm-engine State: closed | Status: done Assignee: meliascosta

Created: 2025-04-25 · Updated: 2025-05-07

Description

AC:

  • There is a notebook that can emulate the update process of the transactions table widget
  • The Jinja template has been included in this task
  • The filters schema has been included in this task

Jinja template

SELECT * FROM transaction
WHERE {% for column, filter in conditions.items() %}
    {% if filter.operator == "BETWEEN" %}
        {{ column }} BETWEEN '{{ filter.value[0] }}' AND '{{ filter.value[1] }}'
    {% else %}
        {{ column }} {{ filter.operator }} '{{ filter.value[0] }}'
    {% endif %}
    {% if not loop.last %} AND {% endif %}
{% endfor %}
{% if pagination.afterId %}
AND id > '{{ pagination.afterId }}'
{% endif %}
{% if pagination.beforeId %}
AND id < '{{ pagination.beforeId }}'
{% endif %}
 
 
ORDER BY id ASC, 
    {% if order_by %} {% for item in order_by %}
    {{ item.column }} {{ item.direction }}
    {% if not loop.last %}, {% endif %}
    {% endfor %}
    {% endif %}
 
{% if pagination.size %}
LIMIT {{ pagination.size }}
{% endif %}
 

Filters schema

See schema
{
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "conditions": {
            "type": "object",
            "properties": {
                "created_at": {
                    "type": "object",
                    "properties": {
                        "operator": {
                            "type": "string",
                            "enum": [
              
 
## Notes
 
_Add implementation notes, blockers, and context here_
 
## Related
 
_Add wikilinks to related people, meetings, or other tickets_