Q: clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server None:None I'm trying to connect clickhouse_driver
=> python3.9
=>clickhouse_driver-0.2.1

【error】clickhouse_driver.errors.UnexpectedPacketFromServerError: Code: 102. Unexpected packet from server None:None (expected Hello or Exception, got Unknown packet)
【DataGrip】Use is normal on DataGrip

class ClickHouse(DB_BASE):
    _user = 'default'
    _pass = 'ddfc272d99a308192ec5961f06133b14b56d2d89ae70ecb02d4acf40d21d1692'
    elec_database = 'test'
    send_receive_timeout = 20000

    def db_connection(self):
        connectConf = {'host': '127.0.0.1', 'port': 8123, 'user': self._user, 'password': self._pass,
                       'send_receive_timeout': self.send_receive_timeout}
        conn = Client(**connectConf)
        sqlSentence = 'show databases'
        rows = conn.execute(sqlSentence)


A: 
ClickHouse server provides two protocols for communication:

*

*HTTP protocol (port 8123 by default);

*Native (TCP) protocol (port 9000 by default).



Clickhouse-driver is designed to communicate with ClickHouse server from Python over native protocol.

Reference: https://clickhouse-driver.readthedocs.io/en/latest/
So if you access ClickHouse server from Python(over native protocol), you should switch the 8123 port to 9000 port.
