SQLPage v0.20.4 documentation

If you are completely new to SQLPage, you should start by reading the get started tutorial, which will guide you through the process of creating your first SQLPage application.

Building an application with SQLPage is quite simple. To create a new web page, just create a new SQL file. For each SELECT statement that you write, the data it returns will be analyzed and rendered to the user. The two most important concepts in SQLPage are components and parameters.

To select a component and set its top-level properties, you write the following SQL statement:

SELECT 'component_name' AS component, 'my value' AS top_level_parameter_1;

Then, you can set its row-level parameters by writing a second SELECT statement:

SELECT my_column_1 AS row_level_parameter_1, my_column_2 AS row_level_parameter_2 FROM my_table;

This page documents all the components provided by default in SQLPage and their parameters. Use this as a reference when building your SQL application. If at any point you need help, you can ask for it on the SQLPage forum.

If you know some HTML, you can also easily create your own components for your application.

components

The "csv" component

A button that lets the user download data as a CSV file. Each column from the items in the component will map to a column in the resulting CSV.

Top-level parameters

title

REQUIRED. The text displayed on the download button.

class

class attribute added to the container in HTML. It can be used to apply custom styling to this item through css. Added in v0.18.0.

color

Color of the button

filename

The name of the file that should be downloaded (without the extension).

icon

Name of the icon (from tabler-icons.io) to display in the button.

id

id attribute added to the container in HTML. It can be used to target this item through css or for scrolling to this item through links (use "#id" in link url).

separator

How individual values should be separated in the CSV. "," by default, set it to "\t" for tab-separated values.

Example 1

CSV download button

select 
    'csv'              as component,
    'Download my data' as title,
    'people'           as filename,
    'file-download'    as icon,
    'green'            as color;
select 
    'Ophir'   as Forename,
    'Lojkine' as Surname,
    'lovasoa' as Pseudonym;
select 
    'Linus'    as Forename,
    'Torvalds' as Surname,
    'torvalds' as Pseudonym;

Result

Official SQLPage documentation