Skip to content

§ 2.2Connecting Data

Connect a Database

The steps below apply to PostgreSQL and MySQL. BigQuery uses a service account; Snowflake uses a dedicated read-only role. Follow their individual setup guides.

4 stepsTick steps off as you go
  1. Open the connection wizard

    Go to Settings → Connections → New Connection and pick your database type.
  2. Enter connection details

    Fill in the following fields:
    Host: your-db.example.com;
    Port: 5432 (PostgreSQL) / 3306 (MySQL);
    Database: your_database_name;
    Username: dashport_readonly;
    Password: ••••••••;
  3. Allowlist Dashport IPs

    Add the following IPs to your database firewall or VPC security group: 52.14.210.5, 18.221.4.33, 3.143.171.87.
  4. Test and save

    Click "Test Connection". Dashport will verify credentials and run a lightweight schema discovery query. Save on success.

Select a Table or Write Custom SQL#

Once your database is connected, Dashport gives you two ways to define the data for each widget:

Select a Table

Browse and choose any table or view in your database. Dashport handles aggregations, filters, and grouping through the widget editor's point-and-click UI. Great for quick exploration.

Write a Custom SQL Query

Write your own SELECT statement and Dashport treats the result as the data source. Your query is the report — all joins, aggregations, and filters are already baked in.

Example Custom SQL Query#

custom-query-example.sqlsql
-- Monthly revenue by product category — report-ready, no further transformation neededSELECT  DATE_TRUNC('month', o.order_date)  AS month,  p.category                          AS category,  SUM(oi.quantity * oi.unit_price)    AS revenue,  COUNT(DISTINCT o.id)                AS order_count,  ROUND(AVG(oi.unit_price), 2)        AS avg_order_valueFROM orders oJOIN order_items oi ON oi.order_id = o.idJOIN products    p  ON p.id = oi.product_idWHERE o.order_date >= NOW() - INTERVAL '12 months'  AND o.status = 'completed'GROUP BY 1, 2ORDER BY 1 DESC, 3 DESC;

Creating a read-only user (PostgreSQL)#

postgres-readonly-user.sqlsql
-- Create a dedicated read-only roleCREATE ROLE dashport_readonly WITH LOGIN PASSWORD 'replace_with_strong_password'; -- Grant connection access to your databaseGRANT CONNECT ON DATABASE your_database TO dashport_readonly; -- Grant usage on the target schemaGRANT USAGE ON SCHEMA public TO dashport_readonly; -- Grant SELECT on all existing tablesGRANT SELECT ON ALL TABLES IN SCHEMA public TO dashport_readonly; -- Grant SELECT on future tables automaticallyALTER DEFAULT PRIVILEGES IN SCHEMA public  GRANT SELECT ON TABLES TO dashport_readonly;