CLI / C
SQLite CLI
Section titled “SQLite CLI”Download a prebuilt loadable for your platform from the
GitHub releases
(predict0-<os>-<arch>.{so,dylib,dll}, checksums in SHA256SUMS) and
.load it. One macOS note: the system /usr/bin/sqlite3 is compiled without
extension loading, so use a stock CLI (brew install sqlite):
sqlite3 mydata.db.load ./predict0
SELECT predict_version();
-- forecast() is an aggregate like sum(): your query supplies the rows,-- and each group returns one JSON documentSELECT forecast(ts, value, 24) FROM readings;Vendor the single C file
Section titled “Vendor the single C file”Every release also ships a single-file amalgamation (sqlite-predict.c) you can
drop into your own program, or compile straight to a loadable:
curl -LO https://github.com/PureStorage-OpenConnect/sqlite-predict/releases/latest/download/sqlite-predict.ccc -fPIC -shared -O3 sqlite-predict.c -o predict0.so # .dylib on macOS, .dll on WindowsTo statically link into your app, compile with -DSQLITE_CORE -DSQLITE_PREDICT_STATIC and call sqlite3_predict_init(db, 0, 0) after opening
each connection.
Next: Operations.