querying-analytics-db
Use when querying the data-analytics-platform online read-only PostgreSQL analytics database, validating dashboard data, inspecting ODS or DWS tables, or running ad hoc SELECT SQL against production analytics.
How do I install this agent skill?
npx skills add https://skill-hub.humanlaya.com --skill querying-analytics-dbIs this agent skill safe to install?
No partner audit is available yet. Read the source before installing.
What does this agent skill do?
Querying Analytics DB
Overview
Use this skill for direct SQL inspection against the online analytics PostgreSQL database for data-analytics-platform. Run read-only SQL and keep result sets bounded.
Connection
Connection target defaults are built into scripts/analytics-sql:
| Setting | Value |
|---|---|
| host | pc-2zeh15g9z2r440cr8.rwlb.rds.aliyuncs.com |
| port | 5432 |
| database | data_label_platform_analytics |
Database credentials are not embedded in this skill. Apply for read-only access here: https://applink.feishu.cn/T98bU4gTRcRs
After access is granted, provide credentials at runtime through ANALYTICS_DB_USER and ANALYTICS_DB_PASSWORD, or let scripts/analytics-sql prompt for them.
Quick Reference
# Prompt for credentials.
read -rp "Analytics DB user: " ANALYTICS_DB_USER
read -rsp "Analytics DB password: " ANALYTICS_DB_PASSWORD; echo
export ANALYTICS_DB_USER ANALYTICS_DB_PASSWORD
# Run a bounded table query.
/Users/carota/.agents/skills/querying-analytics-db/scripts/analytics-sql \
"SELECT schemaname, tablename FROM pg_tables WHERE schemaname IN ('public', 'analytics') LIMIT 20"
# Pipe SQL from a file or heredoc.
/Users/carota/.agents/skills/querying-analytics-db/scripts/analytics-sql --csv <<'SQL'
SELECT *
FROM analytics.dws_project_daily
ORDER BY stat_date DESC
LIMIT 10
SQL
Required Safety Rules
- Only run
SELECT,WITH,EXPLAIN, orSHOW. - Include
LIMITfor exploratory queries unless the aggregate returns one row. - Before writing business SQL, check
references/table-declarations.mdand the linked project docs for table grain and metric semantics. - Prefer
analyticsDWS tables for dashboard validation andpublicODS tables only for source inspection. - Keep date predicates explicit and use Asia/Shanghai business dates when matching dashboard docs.
- Do not run mutating functions, maintenance commands, DDL, DML,
COPY,CALL,DO,REFRESH, or multi-statement SQL. - If a query might be expensive, first inspect table size and indexes, then narrow by date/project/user.
Business Declarations
This database is the online analytics database connected to /Users/carota/Documents/GitHub/data-analytics-platform. Use references/table-declarations.md as the lightweight table map for common business semantics: ODS vs DWD/DWS, table grain, canonical date fields, default filters, and source-of-truth docs.
When a query reveals useful table semantics, update that reference with the table, grain, Business Rule, and Source of Truth. Keep formal metric definitions in the project docs/metrics and formal table definitions in docs/schemas.
Helper Behavior
scripts/analytics-sql performs an offline SQL guard, then executes inside a read-only transaction with statement timeout and no pager. Use --check-only to validate a query without connecting.
/Users/carota/.agents/skills/querying-analytics-db/scripts/analytics-sql --check-only \
"SELECT COUNT(*) FROM analytics.dws_project_daily"
Common Mistakes
| Mistake | Fix |
|---|---|
| Missing database access | Apply through https://applink.feishu.cn/T98bU4gTRcRs |
| Missing runtime credentials | Set ANALYTICS_DB_USER and ANALYTICS_DB_PASSWORD, or wait for prompts |
| Querying raw ODS for complex dashboard metrics | Check DWS schema docs first and query pre-aggregated tables |
| Returning full tables | Add LIMIT, date predicates, and only needed columns |
| Trusting client-side checks alone | Rely on both the script guard and read-only database permissions |
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/skill-hub.humanlaya.com/querying-analytics-db">View querying-analytics-db on skillZs</a>