Testing-containers and clickhouse-driver error:Unexpected EOF while reading bytes

Testing-containers and clickhouse-driver error:Unexpected EOF while reading bytes

我安装了这些库:

testcontainers==2.5
clickhouse-driver==0.1.0

此代码:

from testcontainers.core.generic import GenericContainer
from clickhouse_driver import Client


def test_docker_run_clickhouse():
    ch_container = GenericContainer("yandex/clickhouse-server")
    ch_container.with_bind_ports(9000, 9000)
    with ch_container as ch:

        client = Client(host='localhost')
        print(client.execute("SHOW TABLES"))


if __name__ == '__main__':
    test_docker_run_clickhouse()

我正在尝试使用 clickhouse DB 运行 获取通用容器。

但它给了我:EOFError: Unexpected EOF while reading bytes

我正在使用 Python 3.5.2。如何解决这个问题?

运行 一个容器需要一些时间。在执行操作之前添加一个时间延迟。

import time
with ch_container as ch:
        time.sleep(3)
        client = Client(host='localhost')
        print(client.execute("SHOW TABLES"))