SQL Direct Access (Growth+)
Connect to the portfolIQ Star Schema via standard PostgreSQL — read-only access for psql, DBeaver, Power BI, Tableau, Metabase, and any ODBC/SQL client.
SQL Direct Access (Growth+)
Direct read-only PostgreSQL access to the portfolIQ Star Schema (21 views: 7 dimensions + 10 facts + 4 satellites).
Available on Growth and Enterprise plans (scope star:agg).
Standard PostgreSQL protocol. portfolIQ does not ship certified native connectors for Power BI, Tableau, or other BI tools. All BI tool integrations use the standard PostgreSQL connector (ODBC/JDBC) available in each tool.
Read-only access. Constraints enforced per credential:
statement_timeout = 5s,idle_in_transaction_session_timeout = 30s, connection limit 5.
Prerequisites
- Growth or Enterprise plan (scope
star:aggrequired) - An active API key — see Authentication
Step 1 — Provision your credentials
Send a POST to /v1/billing/sql-credentials with your API key.
The plaintext password is returned exactly once and cannot be retrieved again.
curl -X POST https://api.portfoliq.io/v1/billing/sql-credentials \
-H "X-API-Key: YOUR_API_KEY"
Response (201 — save immediately):
{
"host": "db.portfoliq.io",
"port": 5433,
"database": "portfoliq",
"schema": "star_public",
"username": "sql_user_a3b7f2c1",
"password": "AbCdEf1234GhIjKl5678MnOpQr90StUv",
"expires_at": null,
"note": "Save this password — it cannot be retrieved later"
}
Save your password now. It cannot be retrieved after this response. If you lose it, revoke the credential and create a new one.
Step 2 — Connect
psql
# Connection string (recommended)
psql "postgresql://sql_user_a3b7f2c1:YOUR_PASSWORD@db.portfoliq.io:5433/portfoliq?sslmode=require"
# Or with individual flags
psql \
-h db.portfoliq.io \
-p 5433 \
-U sql_user_a3b7f2c1 \
-d portfoliq \
--set=sslmode=require
Once connected, the search path is already set to star_public via your role.
You can verify with:
SHOW search_path;
SELECT * FROM dim_asset LIMIT 5;
DBeaver
- New Connection > PostgreSQL
- Host:
db.portfoliq.io— Port:5433— Database:portfoliq - Username:
sql_user_a3b7f2c1— Password:YOUR_PASSWORD - Go to the SSL tab — set SSL Mode to
require - Click Test Connection — confirm success
- In the SQL editor, the active schema is
star_public(set via your role)
Power BI Desktop
- Get Data > More… > search
PostgreSQL Database> Connect - Server:
db.portfoliq.io:5433— Database:portfoliq - Data Connectivity mode:
Import(recommended) orDirectQueryfor volumes < 1 M rows - Expand Advanced options > add
SET search_path = star_publicin the SQL statement field, or select thestar_publicschema from the navigator - Credentials: select Database authentication > enter username and password
- Accept the SSL prompt (TLS is required)
Power Query tip: Filter by
asset_idordate_daybefore loading to stay within the 5-second statement timeout.
Tableau Desktop
- Tableau → Connect → To a Server → PostgreSQL
- Server:
db.portfoliq.io— Port:5433— Database:portfoliq - Username:
sql_user_xxxxxxxx— Password: from credentials (Step 1) - Initial SQL (optional):
SET search_path = star_public, public; - Require SSL: enable — TLS is required, non-TLS connections are rejected
- Click Sign In
Tableau tip:
statement_timeout = 5smeans full table scans will be cancelled. Always filter by date range orasset_idin your Tableau data source filters before publishing.
Metabase
- Metabase admin → Databases → Add database → PostgreSQL
- Host:
db.portfoliq.io— Port:5433— Database:portfoliq - Username:
sql_user_xxxxxxxx— Password: from credentials (Step 1) - Schemas to sync: select
star_publiconly — do not syncmarts,dv, orraw - Use a secure connection (SSL): enable
- Click Save — Metabase will sync the schema and make all 21 views available for browsing
Metabase tip: Read-only access is already enforced at the PostgreSQL role level — no additional configuration needed in Metabase permissions.
Lightdash
- Lightdash project setup → Connect warehouse → PostgreSQL
- Host:
db.portfoliq.io— Port:5433— Database:portfoliq— Schema:star_public - Username:
sql_user_xxxxxxxx— Password: from credentials (Step 1) - SSL:
require - dbt integration: point Lightdash to a clone of the
portfoliq-dbtpackage, or to your own dbt project that importsportfoliq-dbtviapackages.yml— this gives you native field-level metadata, descriptions, and relationships directly in the Lightdash UI
Lightdash tip: Because
portfoliq-dbtships withdescription:blocks andrelationships:tests, Lightdash picks up field documentation and join paths automatically once the dbt project is connected.
What you can query
21 views in schema star_public:
| View | Type | Description |
|---|---|---|
dim_asset | Dimension | Asset master data (SCD2) — ticker, name, tier, is_halal |
dim_date | Dimension | Calendar dimension 2009 → today + 1 year |
dim_chain | Dimension | Blockchain networks (chain_id, name, is_evm) |
dim_news_source | Dimension | News publication sources |
dim_event_type | Dimension | Event taxonomy (fork, listing, hack, …) |
dim_analysis_type | Dimension | AI analysis types |
dim_tier | Dimension | portfolIQ asset tiers (1–4) |
sat_asset_metadata_public | Satellite | Multi-source metadata recomputed |
sat_asset_news_public | Satellite | News filtered (no raw title/excerpt) |
sat_asset_market_derived | Satellite | Market cap = VWAP × on-chain supply |
sat_protocol_tvl_self | Satellite | TVL self-calculated from on-chain pool balances |
fact_market_snapshot | Fact | Daily market snapshots (VWAP-based) |
fact_vwap_consensus | Fact | VWAP multi-exchange consensus |
fact_onchain_core | Fact | On-chain core metrics — BTC + ETH |
fact_onchain_advanced | Fact | On-chain advanced metrics — BTC only |
fact_asset_fundamentals | Fact | P/S, P/R ratios — DeFiLlama |
fact_protocol_tvl | Fact | Protocol TVL self-calculated |
fact_protocol_economics | Fact | Fees / revenue — DeFiLlama |
fact_news_mention | Fact | Asset mentions in news |
fact_ai_analysis | Fact | AI-generated analyses (classification, sentiment, summary) |
fact_event | Fact | On-chain and protocol events |
Limits
| Constraint | Value |
|---|---|
statement_timeout | 5 seconds — queries exceeding this are cancelled automatically |
idle_in_transaction_session_timeout | 30 seconds |
| Connection limit | 5 simultaneous connections per credential |
| TLS | Required (sslmode=require) — non-TLS connections are rejected |
| Credential expiry | null = no automatic expiry — revoke manually via DELETE |
| Max active credentials | 5 per API key |
Optimize for the 5-second timeout: always filter by asset_id, date_day, or chain_id. Avoid full-table scans on fact tables.
Manage credentials
List your active credentials (no password returned):
curl https://api.portfoliq.io/v1/billing/sql-credentials \
-H "X-API-Key: YOUR_API_KEY"
Revoke a credential:
curl -X DELETE https://api.portfoliq.io/v1/billing/sql-credentials/sql_user_a3b7f2c1 \
-H "X-API-Key: YOUR_API_KEY"
A revoked PostgreSQL user is immediately dropped — existing connections are terminated.
Disclaimer
Data exposed via SQL access is for informational purposes only. Not financial advice. Not a fatwa. Methodology disclosed at portfoliq.io/methodology.