<p>我在使用timescaledb创建连续聚合时出错,该数据库使用postgres物化视图:</p>
<pre><code>connection = psycopg2.connect(DATABASE_URI)
cursor = connection.cursor()
cursor.execute(
"""CREATE MATERIALIZED VIEW quotes_1h WITH
(timescaledb.continuous)
AS
SELECT ticker, time_bucket('1h', time) as hour,
min(close) as low,
max(close) as high,
first(close, time) as open,
last(close, time) as close
FROM quotes
GROUP BY
ticker, time_bucket('1h', time);""")
connection.commit()
</code></pre>
<p>错误:
psycopg2.errors.ActiveSqlTransaction:创建物化视图。。。WITH DATA不能在事务块内运行</p>
<p>我已经设置了自动提交,但没有帮助</p>