Show HN: PageQL – Embed SQL directly in HTML
a year ago
- #web-framework
- #sql-templating
- #python
- PageQL is an experimental template language and micro Python web framework that allows embedding SQL inside HTML directly.
- Inspired by ColdFusion, Handlebars/Mustache, and HTMX.
- Install via pip: `pip install pageql`.
- Core philosophy: Simplifies web development with relational data by embedding SQL-like queries in HTML.
- Minimal approach: Embraces SQL and HTML, focusing on common web features (lists, forms, CRUD).
- Declarative focus: Encourages clarity by discouraging extensive scripting.
- Leverages SQL: Uses SQL engine for expression evaluation instead of a custom language.
- Key tags include `#from`, `#insert`, `#update`, `#delete`, `#set`, `#param`, `#import`, `#partial`, `#render`, `#if`, `#else`, `#redirect`.
- Example code demonstrates creating a table and querying data directly in HTML.
- Future plans: Embeddable, simple, performant, with potential for reactivity and client-based offline mode.
- Designed for extensibility, with possible reimplementation in other languages (C/C++/Rust/JavaScript).
- Reactive mode leverages declarative nature of HTML and SQL for easier reasoning.
- Client-server complexity reduced via SQL change synchronization protocol.
- Supports templating APIs similar to Mustache/Handlebars/Jinja.
- Currently for hobbyist projects, with future plans for advanced features like routing, authentication, and production deployment.