Execute queued operations with run() and close()
mainSimpleDB uses a deferred execution model. Sync builder methods (like filter() or convert()) only queue operations. Execution is triggered when an async observer method (like getData(), log(), or writeData()) is awaited.
run(): Use this when your script ends in pure mutations with no observer. It executes all queued methods across every table in the database in program order.close(): Executes all pending transformations, saves SDA metadata (for writable persistent databases), and closes the connection, cleans up temporary files, and the cache.
// Nothing is observed after the mutations, so run() executes them.
table1.loadData("data1.csv").convert({ price: "number" });
table2.loadData("data2.csv").filter(`price > 0`);
await sdb.run();
// close() executes queued transformations before cleaning up resources.
table.loadData("data.csv").convert({ price: "number" });
await sdb.close();