You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
491 B
TypeScript

import duckdb from 'duckdb';
const db = new duckdb.Database('./options.duckdb'); // or a file name for a persistent DB
const filename = '/home/brian/Downloads/options-data/2013-01-02options.cvs';
db.run(`CREATE TABLE prices AS SELECT * FROM read_csv_auto('${filename}')`, (err)=>{
if (err) {
throw err;
}
db.all("SELECT count(*) AS count FROM prices WHERE underlying = 'TSLA'", function(err, res) {
if (err) {
throw err;
}
console.log(res[0].count)
});
});