Skip to content

PostgreSQL datasource

PostgreSQL datasource allows fetching data straight from PostgreSQL database.

Working with PostgreSQL

  1. Create a new PostgreSQL connection as explained in the instructions.

  2. Once your connection is ready click on ADD QUERY in the Inspector on the right.

  3. Select PostgreSQL datasource and click CREATE QUERY:

    Postgres type
  4. You can modify all the basic configuration settings as described in queries section.

  5. In addition you can configure following properties inline:

    Postgres configuration
    • 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.

      Parameters configuration

      Like so: SELECT * FROM "db" WHERE name = $name.

  6. Once finished with configuration click SAVE to commit your changes and return to the canvas.