diff --git a/topic/timeseries/timeseries-anomaly-detection.ipynb b/topic/timeseries/timeseries-anomaly-detection.ipynb index 737a08c0..08d7e4cb 100644 --- a/topic/timeseries/timeseries-anomaly-detection.ipynb +++ b/topic/timeseries/timeseries-anomaly-detection.ipynb @@ -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))" ] }, {