This article covers:
To make a connection to a PostgreSQL database, navigate to the Connections page, select New Connection, then PostgreSQL from the New Connection modal:
You will be prompted to provide the following connection details to establish a connection to your PostgreSQL database:
Please refer to the examples in our developer documentation to find out how to create a connection to PostgreSQL via our API.
Notes: To ensure secure access to your PostgreSQL database, it is recommended to whitelist Luzmo's range of IP addresses. You should whitelist Luzmo's range of IP addresses as described here.
Once you have connected your PostgreSQL you can add datasets as explained here.
{{metadata.< parameter name >|< default value >}}. Find out more about parameterized SQL Datasets.Note: If you use PostGIS (PostgreSQL's GIS extension, for geometry type) you can connect your datasets with topography data via our native connector.
Also make sure to check out this article on Preparing your data for analytics.
To find out how to add datasets using our API, please refer to the examples in our developer documentation.
When generating an Authorization token to grant a user acces to your embedded dashboards it is possible to override the data source properties in the authorization request to dynamically use different properties. Find out more about connection overrides.
The fields available for overriding a PostgreSQL connection are as follows:
Our developer documentation has more info about connection overrides and examples of PostgreSQL connection overrides.
Example code demonstrating how to override a PostgreSQL connection:
import Luzmo from '@luzmo/nodejs-sdk';
const client = new Luzmo({
api_key: '<your Luzmo API key>',
api_token: '<your Luzmo API token>',
host: 'https://api.luzmo.com:443'
});
const response = await client.create('authorization',
{
type: "embed",
username: "< A unique and immutable identifier for your user >",
name: "< user name >",
email: "< user email >",
suborganization: "< a suborganization name >",
access: {
collections: [
{
id: "<collection_id>",
inheritRights: "use"
}
]
},
account_overrides: {
<your connection_id>: {
host: "<The new database host URL to connect to>",
user: "<username>",
password: "<password>"
}
}
}
);
| Data Type in PostgreSQL | Data Type in Luzmo |
|---|---|
| date | datetime |
| date[] | datetime[] |
| time without time zone | datetime |
| time without time zone[] | datetime[] |
| time with time zone | datetime |
| time with time zone[] | datetime[] |
| timestamp without time zone | datetime |
| timestamp without time zone[] | datetime[] |
| timestamp with time zone | datetime |
| timestamp with time zone[] | datetime[] |
| bigint | numeric |
| bigint[] | numeric[] |
| bigserial | numeric |
| double precision | numeric |
| double precision[] | numeric[] |
| integer | numeric |
| integer[] | numeric[] |
| money | numeric |
| money[] | numeric[] |
| numeric | numeric |
| numeric[] | numeric[] |
| real | numeric |
| real[] | numeric[] |
| serial | numeric |
| smallint | numeric |
| smallint[] | numeric[] |
| smallserial | numeric |
| bit | hierarchy |
| bit[] | hierarchy[] |
| bit varying | hierarchy |
| bit varying[] | hierarchy[] |
| boolean | hierarchy |
| boolean[] | hierarchy[] |
| bpchar | hierarchy |
| bpchar[] | hierarchy[] |
| character | hierarchy |
| character[] | hierarchy[] |
| character varying | hierarchy |
| character varying[] | hierarchy[] |
| cidr | hierarchy |
| cidr[] | hierarchy[] |
| inet | hierarchy |
| inet[] | hierarchy[] |
| json | hierarchy |
| json[] | hierarchy[] |
| jsonb | hierarchy |
| jsonb[] | hierarchy[] |
| macaddr | hierarchy |
| macaddr[] | hierarchy[] |
| text | hierarchy |
| text[] | hierarchy[] |
| uuid | hierarchy |
| uuid[] | hierarchy[] |
| xml | hierarchy |