use python with TDengine database but got bind params error

81 Views Asked by At

It's quite simple to insert data into TDengine database but still got errors.

use conn.statement("insert info cache_record values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")

The output:

Traceback (most recent call last):
  File "/home/ehigh/work/PythonWorker/Worker/HGSocialSecurity/main.py", line 8, in <module>
    curd.bind_insert([
  File "/home/ehigh/work/PythonWorker/Worker/HGSocialSecurity/curd/cache_table.py", line 15, in bind_insert
    stmt = conn.statement("insert info cache_record values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)")
  File "/home/ehigh/.local/lib/python3.9/site-packages/taos/connection.py", line 103, in statement
    taos_stmt_prepare(stmt, sql)
  File "/home/ehigh/.local/lib/python3.9/site-packages/taos/cinterface.py", line 626, in taos_stmt_prepare
    raise StatementError(msg=taos_stmt_errstr(stmt), errno=res)
  File "/home/ehigh/.local/lib/python3.9/site-packages/taos/cinterface.py", line 656, in taos_stmt_errstr
    err = c_char_p(_libtaos.taos_stmt_errstr(stmt))
  File "/usr/local/python3/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "/usr/local/python3/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/libtaos.so: undefined symbol: taos_stmt_errstr

any idea?

1

There are 1 best solutions below

0
Shuduo On

I guess probably you are running an older version TDengine with the library doesn't provide that function interface.