Connect Luzmo to a DuckDB HTTP server, add datasets, and override connection properties when you embed dashboards.

In this article

1. How to set up a DuckDB connection

To connect to DuckDB, navigate to the Connections page, select New Connection, then select DuckDB from the New Connection modal. You are asked to provide a host, port, and password:

  • host: the publicly reachable HTTPS URL where your DuckDB HTTP server is exposed.
    • Luzmo communicates with DuckDB over HTTP using the httpserver extension, which must be installed and running to make your DuckDB instance reachable.
  • port: the HTTP port on which your DuckDB HTTP server is listening.
  • password: an API key of your choosing. This key is passed along as an X-API-Key HTTP header with every request. Your HTTP endpoint should use this value to identify the caller and return the appropriate client-specific data.
  • database: this field is not used by the DuckDB connector. You may enter any value, but the field must be filled in.
  • username: this field is not used by the DuckDB connector. You may enter any value, but the field must be filled in.

To limit access so that only Luzmo can reach your DuckDB instance, whitelist Luzmo's range of static IP addresses as described in Luzmo's IP addresses.


Please refer to the examples in our developer documentation to find out how to create a connection to DuckDB via our API.

2. How to add datasets

  1. You can select one or multiple datasets available in your DuckDB instance and link them in Luzmo so they can be used together in a dashboard.
  2. You can also add SQL datasets by switching to the SQL tab in the dataset creation modal. While creating or editing a SQL dataset, you can parameterize anything within the query by specifying {{metadata.<parameter name>|<default value>}}. Find out more about parameterized SQL datasets.

Also see Preparing your data for analytics.

3. DuckDB connection overrides

When you generate an authorization token to grant a user access to your embedded dashboards, you can override the data source properties in the authorization request so different properties are used dynamically. Find out more about connection overrides.

When you use connection overrides, the schema of the tables in the override must match the schema of the original datasets. Otherwise queries can fail because of schema mismatches.

The fields available for overriding a DuckDB connection are as follows:

  • Connection ID: the ID of the connection to be overridden. Retrieve the ID as detailed in retrieving a connection ID.
  • host: the new publicly reachable HTTPS URL of the DuckDB HTTP server to connect to.
  • port: the new HTTP port to connect to (optional).
  • password: the new API key to pass as the X-API-Key header, used by your endpoint to serve client-specific data.

This is useful in a multi-tenant setup where you keep a single generic DuckDB connection in Luzmo and override the host and password per end user at authorization time, so each customer sees only their own data from their DuckDB instance.

Example of connection overrides in an authorization request:

{
  "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": {
    "<duckdb_generic_connection_id>": {
      "host": "<tenant_specific_duckdb_host_url>",
      "port": "<optional_port_override>",
      "password": "<client_specific_api_key>"
    }
  }
}

4. Supported data types

Data type in DuckDB Data type in Luzmo
TINYINT numeric
TINYINT[] array[numeric]
SMALLINT numeric
SMALLINT[] array[numeric]
INTEGER numeric
INTEGER[] array[numeric]
BIGINT numeric
BIGINT[] array[numeric]
HUGEINT numeric
HUGEINT[] array[numeric]
UTINYINT[] array[numeric]
USMALLINT[] array[numeric]
UINTEGER[] array[numeric]
UBIGINT[] array[numeric]
FLOAT numeric
FLOAT[] array[numeric]
DOUBLE numeric
DOUBLE[] array[numeric]
REAL numeric
REAL[] array[numeric]
NUMERIC numeric
NUMERIC[] array[numeric]
DECIMAL numeric
DECIMAL[] array[numeric]
VARCHAR hierarchy
VARCHAR[] array[hierarchy]
BOOL hierarchy
BOOLEAN hierarchy
BOOLEAN[] array[hierarchy]
INTERVAL hierarchy
INTERVAL[] array[hierarchy]
UUID hierarchy
UUID[] array[hierarchy]
JSON hierarchy
JSON[] array[hierarchy]
BLOB hierarchy
BLOB[] array[hierarchy]
DATE datetime
DATE[] array[datetime]
TIME datetime
TIME[] array[datetime]
TIMESTAMP datetime
TIMESTAMP[] array[datetime]
GEOMETRY spatial
GEOMETRY[] array[spatial]

Need more information?

Do you still have questions? Let us know how we can help.
Send us feedback!