§ 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
Open the connection wizard
Go toSettings → Connections → New Connectionand pick your database type.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: ••••••••;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.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#
-- 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)#
-- 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;