Skip to main content

SQL Overview

In Propel, you can query your data using SQL. This can be done either through the GraphQL SQL API or the PostgreSQL-compatible SQL interface. Both allow you to benefit from Propel's fast response times, high availability, and access controls, all while using familiar SQL syntax.

Propel's SQL supports PostgreSQL syntax, including joins, unions, and common table expressions for more complex queries. This enables any application or business intelligence (BI) tool that relies on PostgreSQL compatibility to connect seamlessly to Propel.

SQL API​

The SQL API lets you execute SQL queries from your application via the GraphQL API. The SQL API is particularly useful for querying data from web and mobile apps to build dashboards and reports.

The example below demonstrates a simple SQL query to select ten records from a Data Pool using the SQL API. You can query Data Pools by unique name or ID.

query {
sqlV1(input: { query: "SELECT * FROM \"TacoSoft Demo Data\" LIMIT 3" }) {
columns {
columnName
}
rows
}
}

Usage​

Arguments​

The table below describes the input parameters for the SQL API. These parameters allow you to specify the SQL query.

FieldTypeRequiredDescription
queryStringYes

The SQL query.

Read more about SqlV1Input.

Response​

The SQL API responds with a SqlResponse object that includes a values array of headers and an array of arrays with the rows.

FieldTypeNullableDescription
columns array of SqlColumnResponseNo

The column names in the same order as present in the data field.

rows array of StringNo

The data gathered by the SQL query. The data is returned in an N x M matrix format, where the first dimension are the rows retrieved, and the second dimension are the columns. Each cell can be either a string or null, and the string can represent a number, text, date or boolean value.

infoQueryInfoNo

The Query statistics and metadata.

Read more about SqlResponse.

PostgreSQL-compatible SQL interface​

Propel supports the PostgreSQL wire protocol, which allows you to use PostgreSQL clients to connect to Propel. Any business intelligence (BI) tool or application that supports PostgreSQL can also query Propel.

In a sense, Propel pretends to be a PostgreSQL instance, allowing you to connect a client application seamlessly as if it were PostgreSQL.

Connection details​

To connect a client to the SQL Interface, you must create a Propel Application and give it the DATA_POOL_READ and DATAPOOL_QUERY scope.

Once you've created the Application, you can use the connection details below to connect your client to Propel.

DetailValue
Hostpostgresql.us-east-2.propeldata.com
Port5432
Databasepropel
userYour Propel Application ID.
passwordYour Propel Aplication client secret.