我想在Postgres中动态创建TimescaleDB表,因为我正在处理随时间变化的数据源(金融提要,可能是100,可能是1000),我希望每个数据源有一个表.
我可以用Python创建表,这没问题,但是当我调用SELECT create_hypertable(test_table1, time)
时,它会抛出一个错误.当然,当从pSQL执行相同的查询时,它似乎工作得很好,所以时间刻度API可能无法通过psycopg2使用?
环境:
- Python 3.6.4
- psycopg2-binary-2.7.4(安装时带有标志:--无二进制:全部:)
- 博士后:10.3
- Timescaledb:0.8.0-2
- 马科斯:10.13.3
测试代码:
db.query("CREATE TABLE test_table1 (time TIMESTAMP NOT NULL, name CHAR(100) NOT NULL")
db.query("SELECT create_hypertable('test_table1', 'time')")
错误:
2018-03-05 11:45:36,901 [MainThread ] [ERROR] function create_hypertable(unknown, unknown) does not exist
LINE 1: SELECT create_hypertable('temp_table1', 'time')
. . . . . . . . . . . . . . ^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
有人知道目前是否还有其他方法来实现这一点吗?我错过了一些简单的事情吗?或者是否有其他服务可以替代支持动态创建的时间刻度功能?