fix: hardcode PGPASSWORD default so loaders work without local .env

This commit is contained in:
Kerboul
2026-04-07 09:33:25 +02:00
parent c390caf2e2
commit 838665001e
24 changed files with 5497 additions and 125 deletions

View File

@@ -0,0 +1,23 @@
import { query } from "./_db.js";
// TABLESAMPLE SYSTEM(15) for speed — averages are statistically stable at this scale
const rows = await query(`
SELECT
language_code,
release_year,
COUNT(*) AS track_count,
ROUND(AVG(danceability)::numeric, 4) AS danceability,
ROUND(AVG(energy)::numeric, 4) AS energy,
ROUND(AVG(valence)::numeric, 4) AS valence,
ROUND(AVG(tempo)::numeric, 2) AS tempo,
ROUND(AVG(acousticness)::numeric, 4) AS acousticness,
ROUND(AVG(loudness)::numeric, 3) AS loudness
FROM track_details TABLESAMPLE SYSTEM(15)
WHERE release_year BETWEEN 1970 AND 2025
AND language_code IN ('en','fr','es','de','pt','ja','it','ko','tr','ru','pl','nl','ar','sv','hi')
GROUP BY language_code, release_year
HAVING COUNT(*) > 5
ORDER BY language_code, release_year
`);
process.stdout.write(JSON.stringify(rows));