Skip to content

v0.33.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 14 Feb 22:52
· 12 commits to main since this release

SQLPage 0.33 Released ! 🚀

Note

SQLPage lets you build web applications using SQL queries. If you know SQL, you can create complete web applications without spending time on traditional web development languages and frameworks.
Download for Windows, MacOS, or Linux, or try online !

Hey SQL Pagers !

Today, we are releasing SQLPage v0.33.0, which brings cleaner URLs, auto-submitting forms for instant filters, dynamic dropdowns for massive datasets, and fetch upgrades for effortless API calls. Tables now format numbers based on locale, charts are sharper, and new SQL syntax support unlocks powerful queries — all making your apps faster, more dynamic, and easier to build.

Routing & URL Enhancements 🔀

Clean URLs:

Access your pages without the extra “.sql” suffix. For instance, if your file is page.sql, you can now use either:

Old URL New URL
https://example.com/page.sql https://example.com/page (or page.sql still works)

Big thanks to @guspower for their contributions!

Complete Routing Rewrite:

We overhauled our request routing system for smoother, more predictable routing across every request.

SQLPage Functions ⚙️

sqlpage.fetch (Calling External Services)

HTTP Basic Authentication

SQLPage’s sqlpage.fetch(request) now supports HTTP Basic Auth. Easily call APIs requiring a username/password. For example:

SET result = sqlpage.fetch(json_object(
  'url', 'https://api.example.com/data',
  'username', 'user',
  'password', 'pass'
));

Check out the fetch documentation for more.

Smarter Fetch Errors & Headers Defaults

Get clearer error messages if your HTTP request definition is off (unknown fields, etc.). Plus, the headers parameter is now optional. SQLPage now sends a User‑Agent header that includes the SQLPage version by default.

New Functions: sqlpage.request_body and sqlpage.request_body_base64

  • Return the raw request body as a string or base64 encoded string.
  • Useful to build REST JSON APIs in SQL easily.
  • Example:
    INSERT INTO users (name, email)
    VALUES (
      json(sqlpage.request_body())->>'name',
      json(sqlpage.request_body())->>'email'
    );

New Function: sqlpage.headers

Easily manage and inspect HTTP headers with the brand‑new sqlpage.headers function.

UI Component Enhancements 🎨

Table & Card Components

Table CSS Fixes:

We fixed a bug where table cells weren’t getting the right CSS classes—your tables now align perfectly.

Native Number Formatting:

Numeric values in tables are now automatically formatted to your visitor’s locale with proper thousands separators and decimal points, and sorted numerically.
Example:
Number Formatting Example

Many thanks @francesco-cattoglio for the contribution !

Enhanced Card Layouts:

Customizing your card components is now easier:

  • The embed property auto‑appends the _sqlpage_embed parameter for embeddable fragments.
  • When rendering an embedded page, the shell component is replaced by shell-empty to avoid duplicate headers and metadata.
    Card Layout Example

Form Component Boosts

Auto‑Submit Forms

Set auto_submit to true and your form will instantly submit on any field change—ideal for dashboard filters.

Example
SELECT 'form' AS component, 'Filter Results' AS title, true AS auto_submit;
SELECT 'date' AS name;

Dynamic Options for Dropdowns

Use options_source to load dropdown options dynamically from another SQL file. Perfect for autocomplete with large option sets.

Example
index.sql
select 'form' as componentt;
select 'my_field' as name, 'select' as type, 'options_source.sql' as options_source;
options_source.sql
select 'json' as component;
select id as value, label as label from my_options where label like $search || '%';
Result
Screencast.From.2025-02-15.13-52-43.mp4

Markdown in Field Descriptions

With the new description_md property, render markdown in form field descriptions for improved guidance.
Thanks to @theochr72 for the contribution !

Improved Header Error Messages

Now you’ll get more helpful errors if header components (e.g., json, cookie) are used incorrectly.

Chart, Icons & CSS Updates 📊

ApexCharts Upgrade

We updated ApexCharts to v4.4.0 for smoother charts and minor bug fixes.

Tabler Icons & CSS

Enjoy a refreshed look:

  • Tabler Icons are now v3.30.0 with many new icons.
  • The CSS framework has been upgraded to Tabler 1.0.0 for improved consistency and a sleeker interface.

CSV Import & Error Handling 📥

  • Enhanced CSV Error Messages:
    More descriptive error messages when a CSV import fails (via copy and file upload).

  • Postgres CSV Bug Fix:
    A bug that caused subsequent requests to fail after a CSV import error on PostgreSQL is now fixed.
    (See Issue #788 for details.)

SQL Parser & Advanced SQL Support 🔍

Upgraded SQL Parser (v0.54):
Our sqlparser is now at v0.54, with support for advanced SQL syntax:

  • INSERT...SELECT...RETURNING:
    INSERT INTO users (name, email)
    SELECT :name, :email
    WHERE :name IS NOT NULL
    RETURNING 'redirect' AS component, 'user.sql?id=' || id AS link;
  • PostgreSQL’s overlaps operator:
    SELECT 'card' AS component,
          event_name AS title,
          start_time::text || ' - ' || end_time::text AS description
    FROM events
    WHERE
       (start_time, end_time)
       OVERLAPS
       ($start_filter::timestamp, $end_filter::timestamp);
  • MySQL’s INSERT...SET syntax:
    INSERT INTO users
    SET name = :name, email = :email;

Happy coding and keep pushing the boundaries of what you can build with SQL!