TimescaleDB: Is it possible to call 'create_hypertable' from Python?

You might try casting your inputs it looks like it could be an issue with the way inputs are being treated.So something like SELECT create_hypertable('test_table1'::regclass, 'time'::name); might work better.


I had the same issue on Postgres: 12, it's resolved in Postgres: 13 by adding the parameter if_not_exists:

SELECT create_hypertable('table_name', 'time', if_not_exists => TRUE);

That output implies that you haven't installed the TimescaleDB extension on the database you're running create_hypertable on. Make sure you run:

CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;

on your database before running create_hypertable. To ensure the extension has been created, run the following query:

select * from pg_extension;

psycopg shouldn't have any effect on this as the .query() call appears to just be executing the raw SQL you pass it. Make sure your psycopg client is connected to the same database as the one you initially installed the TimescaleDB extension on.