use duckdb, nodejs

This commit is contained in:
Brian Sakal
2023-04-30 09:33:39 -04:00
parent 3b0ff3d950
commit c428dfec43
8 changed files with 978 additions and 95 deletions
+14
View File
@@ -0,0 +1,14 @@
import duckdb from "duckdb";
const db = new duckdb.Database("./options.duckdb");
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(err2, res) {
if (err2) {
throw err2;
}
console.log(res[0].count);
});
});