Merge pull request #4427 from taosdata/test/testcase
[TD-785]Improve the robustness of python connector
This commit is contained in:
commit
0e4e126d17
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.2",
|
version="2.0.3",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,7 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0'
|
apilevel = '2.0.3'
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ def _crow_double_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
||||||
else:
|
else:
|
||||||
|
@ -106,6 +107,7 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
res=[]
|
res=[]
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
for i in range(abs(num_of_rows)):
|
for i in range(abs(num_of_rows)):
|
||||||
|
|
|
@ -26,7 +26,7 @@ class TDengineCursor(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, connection=None):
|
def __init__(self, connection=None):
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
self._connection = None
|
self._connection = None
|
||||||
self._result = None
|
self._result = None
|
||||||
|
@ -234,7 +234,7 @@ class TDengineCursor(object):
|
||||||
def _reset_result(self):
|
def _reset_result(self):
|
||||||
"""Reset the result to unused version.
|
"""Reset the result to unused version.
|
||||||
"""
|
"""
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
if self._result is not None:
|
if self._result is not None:
|
||||||
CTaosInterface.freeResult(self._result)
|
CTaosInterface.freeResult(self._result)
|
||||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.2",
|
version="2.0.3",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,7 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0'
|
apilevel = '2.0.3'
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ def _crow_double_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
||||||
else:
|
else:
|
||||||
|
@ -106,6 +107,7 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
res=[]
|
res=[]
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
for i in range(abs(num_of_rows)):
|
for i in range(abs(num_of_rows)):
|
||||||
|
|
|
@ -27,7 +27,7 @@ class TDengineCursor(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, connection=None):
|
def __init__(self, connection=None):
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
self._connection = None
|
self._connection = None
|
||||||
self._result = None
|
self._result = None
|
||||||
|
@ -242,7 +242,7 @@ class TDengineCursor(object):
|
||||||
def _reset_result(self):
|
def _reset_result(self):
|
||||||
"""Reset the result to unused version.
|
"""Reset the result to unused version.
|
||||||
"""
|
"""
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
if self._result is not None:
|
if self._result is not None:
|
||||||
CTaosInterface.freeResult(self._result)
|
CTaosInterface.freeResult(self._result)
|
||||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.2",
|
version="2.0.3",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,7 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0'
|
apilevel = '2.0.3'
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ def _crow_double_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
||||||
else:
|
else:
|
||||||
|
@ -106,6 +107,7 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
res=[]
|
res=[]
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
for i in range(abs(num_of_rows)):
|
for i in range(abs(num_of_rows)):
|
||||||
|
|
|
@ -27,7 +27,7 @@ class TDengineCursor(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, connection=None):
|
def __init__(self, connection=None):
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
self._connection = None
|
self._connection = None
|
||||||
self._result = None
|
self._result = None
|
||||||
|
@ -193,7 +193,7 @@ class TDengineCursor(object):
|
||||||
def _reset_result(self):
|
def _reset_result(self):
|
||||||
"""Reset the result to unused version.
|
"""Reset the result to unused version.
|
||||||
"""
|
"""
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
if self._result is not None:
|
if self._result is not None:
|
||||||
CTaosInterface.freeResult(self._result)
|
CTaosInterface.freeResult(self._result)
|
||||||
|
|
|
@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="taos",
|
name="taos",
|
||||||
version="2.0.2",
|
version="2.0.3",
|
||||||
author="Taosdata Inc.",
|
author="Taosdata Inc.",
|
||||||
author_email="support@taosdata.com",
|
author_email="support@taosdata.com",
|
||||||
description="TDengine python client package",
|
description="TDengine python client package",
|
||||||
|
|
|
@ -3,7 +3,7 @@ from .connection import TDengineConnection
|
||||||
from .cursor import TDengineCursor
|
from .cursor import TDengineCursor
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
apilevel = '2.0'
|
apilevel = '2.0.3'
|
||||||
threadsafety = 0
|
threadsafety = 0
|
||||||
paramstyle = 'pyformat'
|
paramstyle = 'pyformat'
|
||||||
|
|
||||||
|
|
|
@ -81,6 +81,7 @@ def _crow_double_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
return [ None if ele.value[0:1] == FieldType.C_BINARY_NULL else ele.value.decode('utf-8') for ele in (ctypes.cast(data, ctypes.POINTER(ctypes.c_char * nbytes)))[:abs(num_of_rows)]]
|
||||||
else:
|
else:
|
||||||
|
@ -108,6 +109,7 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, micro=False):
|
||||||
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, micro=False):
|
||||||
"""Function to convert C binary row to python row
|
"""Function to convert C binary row to python row
|
||||||
"""
|
"""
|
||||||
|
assert(nbytes is not None)
|
||||||
res=[]
|
res=[]
|
||||||
if num_of_rows > 0:
|
if num_of_rows > 0:
|
||||||
for i in range(abs(num_of_rows)):
|
for i in range(abs(num_of_rows)):
|
||||||
|
|
|
@ -28,7 +28,7 @@ class TDengineCursor(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, connection=None):
|
def __init__(self, connection=None):
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
self._connection = None
|
self._connection = None
|
||||||
self._result = None
|
self._result = None
|
||||||
|
@ -194,7 +194,7 @@ class TDengineCursor(object):
|
||||||
def _reset_result(self):
|
def _reset_result(self):
|
||||||
"""Reset the result to unused version.
|
"""Reset the result to unused version.
|
||||||
"""
|
"""
|
||||||
self._description = None
|
self._description = []
|
||||||
self._rowcount = -1
|
self._rowcount = -1
|
||||||
if self._result is not None:
|
if self._result is not None:
|
||||||
CTaosInterface.freeResult(self._result)
|
CTaosInterface.freeResult(self._result)
|
||||||
|
|
Loading…
Reference in New Issue