Skip to content
1 change: 1 addition & 0 deletions taos/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# encoding:UTF-8
import os
from taos.bind import *
from taos.bind2 import *
from taos.connection import TaosConnection
Expand Down
6 changes: 0 additions & 6 deletions taos/bind.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
import ctypes
from ctypes import *
from datetime import datetime
from typing import List, Optional

from taos.cinterface import IS_V3
from taos.constants import FieldType
from taos.precision import PrecisionEnum, PrecisionError
from taos.field import get_tz
from taos.bind_base import datetime_to_timestamp

_datetime_epoch = datetime.utcfromtimestamp(0)


def _is_not_none(obj):
return obj is not None


class TaosBind(ctypes.Structure):
_fields_ = [
("buffer_type", c_int),
Expand Down
5 changes: 3 additions & 2 deletions taos/cinterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,6 @@ def taos_query(connection, sql):
"""
try:
ptr = c_char_p(sql.encode("utf-8"))
# if sql.lower().startswith("insert"):
# raise ProgrammingError(sql, 1)
res = c_void_p(_libtaos.taos_query(connection, ptr))
errno = taos_errno(res)
if errno != 0:
Expand Down Expand Up @@ -1311,6 +1309,8 @@ def taos_stmt2_is_insert(stmt):
TAOS_FIELD_TAG = 2
TAOS_FIELD_QUERY = 3
TAOS_FIELD_TBNAME = 4


# get fields
def taos_stmt2_get_fields(stmt):
# type: (ctypes.c_void_p) -> Tuple[int, List[TaosFieldAll]]
Expand Down Expand Up @@ -1791,6 +1791,7 @@ def tmq_conf_set(conf, key, value):
if not isinstance(value, str):
raise TmqError(msg=f"fail to execute tmq_conf_set({key},{value}), {value} is not string type")

print(f"tmq_conf_set key={key}, value={value}")
tmq_res = _libtaos.tmq_conf_set(conf, ctypes.c_char_p(key.encode("utf-8")), ctypes.c_char_p(value.encode("utf-8")))
if tmq_res != 0:
raise TmqError(msg=f"fail to execute tmq_conf_set({key},{value}), code={tmq_res}", errno=tmq_res)
Expand Down
1 change: 0 additions & 1 deletion taos/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ def subscribe(
callback: Optional[subscribe_callback_type] = None,
param: Optional[c_void_p] = None,
) -> Optional[TaosSubscription]:

"""Create a subscription."""
if self._conn is None:
return None
Expand Down
3 changes: 1 addition & 2 deletions taos/constants.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# encoding:UTF-8

"""Constants in TDengine python
"""
"""Constants in TDengine python"""

import ctypes, struct
from enum import Enum
Expand Down
6 changes: 1 addition & 5 deletions taos/log.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import time
import os
import sys


# info
show_info = True
show_warn = True
Expand All @@ -11,6 +6,7 @@
show_debug2 = False
show_debug3 = False


# set show
def setting(info, warn, debug, debug1, debug2, debug3):
global show_info, show_warn, show_debug, show_debug1, show_debug2, show_debug3
Expand Down
2 changes: 0 additions & 2 deletions taos/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def __next__(self):
return self._next_row()

def next(self):
# fetch next row
return self._next_row()

def _next_row(self):
Expand All @@ -43,7 +42,6 @@ def _next_row(self):
if self._block is None or self._block_iter >= self._block_length:
self._block, self._block_length = self.fetch_block()
self._block_iter = 0
# self._row_count += self._block_length

raw = self._block[self._block_iter]
self._block_iter += 1
Expand Down
2 changes: 1 addition & 1 deletion taos/statement2.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def obtainSchema(statement2):
raise StatementError("stmt2 object is null.")

try:
count, fields = statement2.get_fields()
_, fields = statement2.get_fields()
statement2.tag_fields = []
statement2.fields = []
statement2.all_fields = fields
Expand Down
1 change: 1 addition & 0 deletions taos/tmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ def assignment(self):
Returns the current partition assignment as a list of TopicPartition tuples.
"""
topics = tmq_subscription(self._tmq)
print(f"tmq_subscription topics: {topics}")
if not topics:
return None

Expand Down
5 changes: 5 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import os

IS_WS = os.getenv("TDENGINE_DRIVER", "native").lower() == "websocket"

PORT = 6030 if not IS_WS else 6041
Loading
Loading