taosdata / TDengine

TDengine is an open source, high-performance, cloud native time-series database optimized for Internet of Things (IoT), Connected Cars, Industrial IoT and DevOps.
https://tdengine.com
GNU Affero General Public License v3.0
23.02k stars 4.83k forks source link

taos.error.ProgrammingError: [0x0216]: syntax error near 'unrecognized token: ""' #26407

Open jiabaoyu114 opened 6 days ago

jiabaoyu114 commented 6 days ago

============================= test session starts ============================= collecting ... collected 1 item

connect_example.py::test_connection FAILED [100%]client info: 2.6.0.34 server info: 2.6.0.12

connect_example.py:10 (test_connection) def test_connection():

all parameters are optional.

    # if database is specified,
    # then it must exist.
    conn = taos.connect(host="192.168.1.206",
                        port=6030,
                        user="root",
                        password="taosdata",
                        database="fastbee_log")
    print('client info:', conn.client_info)
    print('server info:', conn.server_info)
  result: taos.TaosResult = conn.query("select * from device_d1124a81570s")

connect_example.py:22:


C:\DevelopmentLanguage\python\Python38\lib\site-packages\taos\connection.py:85: in query res = taos_query(self._conn, sql)


connection = c_void_p(1526890475472), sql = 'select * from device_d1124a81570s'

def taos_query(connection, sql):
    # type: (c_void_p, str) -> c_void_p
    """Run SQL

    - sql: str, sql string to run

    @return: TAOS_RES*, result pointer

    """
    try:
        ptr = c_char_p(sql.encode("utf-8"))
        res = c_void_p(_libtaos.taos_query(connection, ptr))
        errno = taos_errno(res)
        if errno != 0:
            errstr = taos_errstr(res)
            taos_free_result(res)
          raise ProgrammingError(errstr, errno)

E taos.error.ProgrammingError: [0x0216]: syntax error near 'unrecognized token: ""'

C:\DevelopmentLanguage\python\Python38\lib\site-packages\taos\cinterface.py:329: ProgrammingError

============================== 1 failed in 0.28s ==============================

Process finished with exit code 1

jiabaoyu114 commented 6 days ago

image 查询sql语句在cmd中,可以正常执行。

jiabaoyu114 commented 6 days ago

找到问题了,client info: 2.6.0.34 和 server info: 2.6.0.12 版本不一致所造成的。