D S
11/25/2025, 1:09 AMBenjamin Hopp
11/25/2025, 3:22 AMRenato CRON
11/25/2025, 3:55 AMSELECT ... FROM GL_03_MSGS WHERE
__time >= MILLIS_TO_TIMESTAMP(CAST(? as BIGINT)) -- Query start time
AND __time < MILLIS_TO_TIMESTAMP(CAST(? as BIGINT)) -- Query end time,
autoParams: queryParams,
asStream: true,
context: {
timeout: 60000 * 10,
priority: 10, // Set some higher priority for this query
},
timezone: 'UTC',
resultFormat: 'csv',
withHeaders: 'columns',
});
// Create raw_events table and load data from CSV
await db.all(CREATE TABLE raw_events AS
SELECT * FROM read_csv_auto('${url}', header = true, delim = ','););
// Then inside duckdb, you can connect/ merge/ etc with postgres/iceberg