小编abr*_*net的帖子

将 hypertable 转换为常规 postgres 表

对 timescaledb 来说相当陌生,我正在努力处理迁移脚本。我正在尝试使用 SQLAlchemy 为 Flask 应用程序创建迁移。

假设我创建了一个表(如 timescaledb 文档中所示),如下所示:

CREATE TABLE conditions (
  time        TIMESTAMPTZ       NOT NULL,
  location    TEXT              NOT NULL,
  temperature DOUBLE PRECISION  NULL,
  humidity    DOUBLE PRECISION  NULL
);
Run Code Online (Sandbox Code Playgroud)

要添加超表,我的升级迁移脚本应该执行以下操作:

SELECT create_hypertable('conditions', 'time');
Run Code Online (Sandbox Code Playgroud)

降级部分应该是什么样子?从timescaledb 文档中,他们建议:

DROP table conditions;
Run Code Online (Sandbox Code Playgroud)

但我不想删除整个表,只删除“超表”部分(如果有意义的话)。也许这是愚蠢且毫无意义的,我想通过我们的迁移提供一种摆脱 timescaledb 的方法。我已经读过这个问题:Creating Hypertables through SQL Alchemy,其中似乎没有为 SQLAlchemy 提供特定支持,并且他们建议使用触发器来创建超表而不是特定的迁移。

你有什么建议?

sqlalchemy flask timescaledb

8
推荐指数
2
解决办法
4451
查看次数

从 chrome webdriver (python) 访问 getEventListeners

目的:

从 selenium webdriver 获取附加到节点的所有事件


我正在使用 selenium-python 并且我想执行一个 javascript 脚本(通过driver.execute_script('my js script').

此脚本使用getEventListeners仅在Chrome 上可用。我成功使用

driver = webdriver.Chrome('path/to/chromedriver')
Run Code Online (Sandbox Code Playgroud)

启动 Chrome 浏览器。用getEventListeners(myNode)我执行我的脚本得到类似的东西:

文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”,第 403 行,在 execute_script {'script': script, 'args':converted_args})['value '] 文件“/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”,第 175 行,在执行 self.error_handler.check_response(response) 文件“/usr/local/ lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py", line 166, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: getEventListeners没有定义的

getEventListeners可通过命令行 API 获得,但我无法通过 selenium 使其工作。有解决方案吗?有没有其他方法可以将所有事件绑定到一个元素?(尤其是 Click 事件)

干杯

javascript python selenium google-chrome

5
推荐指数
1
解决办法
1276
查看次数