Query Postgres Data right within Bricks

I actually created a feature request for this to be added natively. But just to prove the concept I wrote out a indepth technical brief and used Claude Code to create the Nhost Postgress Query add-on.

In the back-end you create your connection either directly with Hasura (not recommended from a safety point of view, but easy for testing), specific GraphQL queries or direct database access (needs the php-pgsql module).

Then you create specific query tables (you can query the views also) you want to use in your website.

After that you have a few ways to work with the data. You can either do one query on a page for example to only retrieve specific data from the database within a page OR you can work with the whole query and it’s data. The great thing is you can also work with the JSONB fields from Postgres, meaning you can create for example spec sheets easily without the for creating a unique column for each spec in your database.

Take a look:

Currently I’m only using it to test some use cases. Nothing is published and again it’s more a proof of concept for bricks developers to showcase the benefits of using directly postgres connection for specific use cases.