美文网首页
clickhouse-- EOFError: Unexpecte

clickhouse-- EOFError: Unexpecte

作者: mysimplebook | 来源:发表于2020-09-02 18:16 被阅读0次

        今天clickhouse换了个服务器,从20.3.12换到版本19.16.19,发现之前脚本中使用的client api不能用了,报错如下

    >>> client.execute('SHOW DATABASES')

    Traceback (most recent call last):

      File "<stdin>", line 1, in <module>

      File "/usr/lib64/python2.7/site-packages/clickhouse_driver/client.py", line 205, in execute

        self.connection.force_connect()

      File "/usr/lib64/python2.7/site-packages/clickhouse_driver/connection.py", line 184, in force_connect

        self.connect()

      File "/usr/lib64/python2.7/site-packages/clickhouse_driver/connection.py", line 256, in connect

        return self._init_connection(host, port)

      File "/usr/lib64/python2.7/site-packages/clickhouse_driver/connection.py", line 238, in _init_connection

        self.receive_hello()

      File "/usr/lib64/python2.7/site-packages/clickhouse_driver/connection.py", line 331, in receive_hello

        packet_type = read_varint(self.fin)

      File "clickhouse_driver/varint.pyx", line 40, in clickhouse_driver.varint.read_varint

      File "clickhouse_driver/bufferedreader.pyx", line 55, in clickhouse_driver.bufferedreader.BufferedReader.read_one

      File "clickhouse_driver/bufferedreader.pyx", line 191, in clickhouse_driver.bufferedreader.BufferedSocketReader.read_into_buffer

    EOFError: Unexpected EOF while reading bytes

    >>>

    网上无解,原因不知道。没办法去官方文档上翻一翻

    https://clickhouse-driver.readthedocs.io/en/latest/dbapi.html#connection

    发现可以使用另外一个api 连接数据库(DB API 2.0)---connect,可以规避这个问题

    github上使用示例:

            https://github.com/mymarilyn/clickhouse-driver

    相关文章

      网友评论

          本文标题:clickhouse-- EOFError: Unexpecte

          本文链接:https://www.haomeiwen.com/subject/syiwsktx.html