Search…
Making SQL queries
An overview of SQL request with PostgreSQL
To quickly configure the display of your data from a database, you can build SQL queries by selecting Custom SQL.

Open SQL Query Builder

You can open the SQL Builder directly from the component simply by selecting the SQL resource. The SQL Builder will be opened automatically in case you do not create any collections yet, otherwise you will need to select Make SQL Query from the list of collections for your SQL resource:

Pass Inputs

To pass values from SQL Query Builder, such as idor email, you need to specify them within the Inputs tab:

Use inputs in the query

For example, you need to select data with a specific id or emailfrom the table, you can make an SQL query and use the parameters:

Migrating from old Inputs syntax (before Jet Admin v2.4.0)

Since Jet Admin v2.4.0 we have changed the way how parameters are inserted in SQL query. Now you don't need to surround parameter value with quotes. Previously saved queries will continue to work, but you will need remove unnecessary quotes when you will be changing the query (or use compatibility flag described below).
1
SELECT * FROM people WHERE
2
city = {{params.city}}
3
AND age >= {{params.age}}
4
AND name ILIKE {{'%'+params.search+'%'}}
5
6
# Before Jet Admin v2.4.0
7
8
SELECT * FROM people WHERE
9
city = '{{params.city}}'
10
AND age >= {{params.age}}
11
AND name ILIKE '%{{params.search}}%'
Copied!
You can use compatibility flag if you want to stay with old parameters syntax, but it will be deprecated at some moment. Just insert the following option at the top of the query.
1
-- @JET_QUERY_VERSION=1
2
SELECT * FROM people WHERE city = '{{params.city}}'
Copied!
Last modified 2mo ago