PostgreSQL datasource
PostgreSQL datasource allows fetching data straight from PostgreSQL database.
Working with PostgreSQL
Create a new PostgreSQL connection as explained in the instructions.
Once your connection is ready click on ADD QUERY in the Inspector on the right.
Select PostgreSQL datasource and click CREATE QUERY:
You can modify all the basic configuration settings as described in queries section.
In addition you can configure following properties inline:
On the left is a SQL query editor.
On the right is a table for previewing results.
Below the query editor you can configure parameters which can be used to bind page state to your SQL query. Toolpad uses prepared statements under the hood to prevent SQL injection. You can use the positional parameter syntax (
$1
,$2
,$3
) of postgres prepared statements. Additionally it will also accept named parameters of the form$myParameter
.Like so:
SELECT * FROM "db" WHERE name = $name
.
Once finished with configuration click SAVE to commit your changes and return to the canvas.