[TD-6506]<test>: Add unit test cases for parsing OpenTSDB telnet style data import format
This commit is contained in:
parent
19adc36771
commit
2aee93f46b
|
@ -830,6 +830,16 @@ def taos_insert_lines(connection, lines):
|
||||||
if errno != 0:
|
if errno != 0:
|
||||||
raise LinesError("insert lines error", errno)
|
raise LinesError("insert lines error", errno)
|
||||||
|
|
||||||
|
def taos_insert_telnet_lines(connection, lines):
|
||||||
|
# type: (c_void_p, list[str] | tuple(str)) -> None
|
||||||
|
num_of_lines = len(lines)
|
||||||
|
lines = (c_char_p(line.encode("utf-8")) for line in lines)
|
||||||
|
lines_type = ctypes.c_char_p * num_of_lines
|
||||||
|
p_lines = lines_type(*lines)
|
||||||
|
errno = _libtaos.taos_insert_telnet_lines(connection, p_lines, num_of_lines)
|
||||||
|
if errno != 0:
|
||||||
|
raise LinesError("insert telnet lines error", errno)
|
||||||
|
|
||||||
|
|
||||||
class CTaosInterface(object):
|
class CTaosInterface(object):
|
||||||
def __init__(self, config=None):
|
def __init__(self, config=None):
|
||||||
|
|
|
@ -145,6 +145,15 @@ class TaosConnection(object):
|
||||||
"""
|
"""
|
||||||
return taos_insert_lines(self._conn, lines)
|
return taos_insert_lines(self._conn, lines)
|
||||||
|
|
||||||
|
def insert_telnet_lines(self, lines):
|
||||||
|
"""OpenTSDB telnet style API format support
|
||||||
|
|
||||||
|
## Example
|
||||||
|
cpu_load 1626056811855516532ns 2.0f32 id="tb1",host="host0",interface="eth0"
|
||||||
|
|
||||||
|
"""
|
||||||
|
return taos_insert_telnet_lines(self._conn, lines)
|
||||||
|
|
||||||
def cursor(self):
|
def cursor(self):
|
||||||
# type: () -> TaosCursor
|
# type: () -> TaosCursor
|
||||||
"""Return a new Cursor object using the connection."""
|
"""Return a new Cursor object using the connection."""
|
||||||
|
|
Loading…
Reference in New Issue