Postgres Command

I'm going to the database and I'm going to get some data

We are now ready to use the plugin to query data from our database.

The Postgres Command is currently the only action available for connecting to a Postgres database. The workflow property editor requires you to specify the following fields:

  • Query Type: Choose from the dropdown list of options

    • RAW (the only available option currently)

  • Query: The query text to retrieve/modify the database.

    • e.g. "SELECT * FROM dbo.Customers"

  • Data Type: The custom Data Type field definition

    • Note: This Data Type must be a custom Data Type defined by the Bubble SQL Connector and not a Bubble Database Data Type

An example select statement based on the customer definition we have been using:

When you retrieve the results the action makes several properties available for use within further workflow steps. These properties are:

  • Data: This property gives you access to the results data object.

    • Note: The Data Type of this property is the custom Data Type defined in the "Data Type" field specified in the SQL Command property editor.

  • timer: This property allows you to determine how long the query is taking to execute. This field is provided to help in debugging.

  • json: This property contains the JSON results of the data type. This is convenient if you need to pass the data along to another API/workflow which requires JSON input.

  • meta: If there is meta information returned by the query it will be available in this field. If the query returns no meta information then this field will be empty.

  • Completed: This field will be "yes" when the query has completed and "no" while it is still running. This is convenient for loading pages/icons.

You can execute the Postgres Command on the "Page is Loaded" event or on a button click event or however works best in your application. Then set a custom state with the results and use them in your application.

Since we have defined the custom type you can use all of the field properties as you would with data coming directly out of the Bubble default database.

Last updated