Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sqlpage 0.33.0 #207752

Merged
merged 2 commits into from
Feb 15, 2025
Merged

sqlpage 0.33.0 #207752

merged 2 commits into from
Feb 15, 2025

Conversation

BrewTestBot
Copy link
Member

Created by brew bump


Created with brew bump-formula-pr.

release notes

SQLPage v0.33.0 Release Notes (2025-02-15) 🚀

Hey SQL Pagers !

SQLPage 0.33.0 brings clean URLs for seamless navigation, 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 advanced SQL support unlocks powerful queries—all making your apps faster, more dynamic, and easier to build.

1. 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.


2. 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](https://sql-page.com/documentation.sql?component=fetch#component)](https://sql-page.com/documentation.sql?component=fetch#component) for more.

- **Smarter Fetch Errors & Headers Defaults:**  
Get clearer error messages if your HTTP request definition is off (unknown fields, etc.). Plus, if you omit the `headers` parameter, SQLPage now sends a default User‑Agent header that includes the SQLPage version.

- **New Function: [sqlpage.headers](https://sql-page.com/functions.sql?function=headers):**  
Easily manage and inspect HTTP headers with the brand‑new [`sqlpage.headers`](https://sql-page.com/functions.sql?function=headers) function.

---

### 3. 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:_  
```sql
SELECT 'table' AS component, 'Sales Data' AS title;
SELECT amount AS "Total Sales" FROM sales;

Number Formatting Example

  • 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:
    SELECT 'form' AS component, 'Select Country' AS title, 'countries.sql' AS options_source;
    SELECT 'country' AS name;
  • Markdown in Field Descriptions:
    With the new description_md property, render markdown in form field descriptions for improved guidance.
  • Improved Header Error Messages:
    Now you’ll get more helpful errors if header components (e.g., json, cookie) are used incorrectly.

4. Chart, Icons & CSS Updates 📊


5. CSV Import & Error Handling 📥


6. 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;
    SELECT event_name AS title, start_time || ' - ' || end_time 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;

In Conclusion 💡

This release makes SQLPage even more robust, flexible, and user‑friendly. We’ve refined the core routing, enhanced our function and component libraries, and improved error handling to give you a smoother development experience. As always, your feedback drives our evolution—happy coding and keep pushing the boundaries of what you can build with SQL!

Enjoy the update and keep those SQL queries flowing!

@github-actions github-actions bot added rust Rust use is a significant feature of the PR or issue bump-formula-pr PR was created using `brew bump-formula-pr` labels Feb 14, 2025
Copy link
Contributor

🤖 An automated task has requested bottles to be published to this PR.

@github-actions github-actions bot added the CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. label Feb 15, 2025
@BrewTestBot BrewTestBot added this pull request to the merge queue Feb 15, 2025
Merged via the queue into master with commit 396a5bb Feb 15, 2025
15 checks passed
@BrewTestBot BrewTestBot deleted the bump-sqlpage-0.33.0 branch February 15, 2025 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump-formula-pr PR was created using `brew bump-formula-pr` CI-published-bottle-commits The commits for the built bottles have been pushed to the PR branch. rust Rust use is a significant feature of the PR or issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants