Skip to content

Commit

Permalink
TSML: Fix CrateDB write sync with timeseries-anomaly-detection.ipynb
Browse files Browse the repository at this point in the history
This may mitigate the error `ValueError: Found array with 0 sample(s)`.
  • Loading branch information
amotl committed Apr 18, 2024
1 parent 3df542b commit 394f3dc
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions topic/timeseries/timeseries-anomaly-detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,14 @@
"\n",
"engine = sa.create_engine(CONNECTION_STRING, echo=os.environ.get('DEBUG'))\n",
"\n",
"query_create_table = 'CREATE TABLE machine_data (\"timestamp\" TIMESTAMP, \"value\" DOUBLE PRECISION)' \n",
"query_copy_from = \"COPY machine_data FROM 'https://github.com/crate/cratedb-datasets/raw/main/timeseries/nab-machine-failure.csv';\"\n",
"sql_ddl = 'CREATE TABLE machine_data (\"timestamp\" TIMESTAMP, \"value\" DOUBLE PRECISION)'\n",
"sql_load = \"COPY machine_data FROM 'https://github.com/crate/cratedb-datasets/raw/main/timeseries/nab-machine-failure.csv';\"\n",
"sql_refresh = \"REFRESH TABLE machine_data;\"\n",
"\n",
"with engine.connect() as conn:\n",
" conn.execute(sa.text(query_create_table))\n",
" conn.execute(sa.text(query_copy_from))\n"
" conn.execute(sa.text(sql_ddl))\n",
" conn.execute(sa.text(sql_load))\n",
" conn.execute(sa.text(sql_refresh))"
]
},
{
Expand Down

0 comments on commit 394f3dc

Please sign in to comment.