This example repository accompanies the Datalayers + TimesFM 2.5 hands-on blog post. It demonstrates a complete minimal workflow:
- Create a time-series table in Datalayers.
- Load CSV data into the table.
- Read data through FlightSQL.
- Run forecasting with TimesFM 2.5.
- Export forecast CSV and visualization.
- Python
>= 3.10 - A running Datalayers instance (with FlightSQL enabled). We recommend running Datalayers on docker.
- Network access from this project to your Datalayers service
Install the required libraries in your environment:
pip install \
pandas \
matplotlib \
flightsql-dbapi \
kagglehubNotes:
- It's required to install
timesfm2.5directly from source code.
- Create database/table:
# Run sql in scripts/init_db.sql against your Datalayers SQL endpoint
# We provide `dlsql` to connect Datalayers server with following commands:
dlsql -h localhost -P 8360 -u admin -p public
# After entering the cli, you can create database using `CREATE DATABASE <dbname>`, and `exit` to exit.
# If you are not changed to the target database, use `use <dbname>` to enter your database.- Load CSV data:
python scripts/load_csv_via_flightsql.py \
--csv /path/to/your/dataset.csv \
--table <tablename> \
--host localhost \
--port 8360 \
--user admin \
--password public \
--db <dbname>- Run forecasting and visualization:
python example/visualization.py- Check outputs:
outputs/timesfm25_forecast.csvoutputs/timesfm25_visualization.png
This setup is intended for experimentation and learning.
