Merge remote-tracking branch 'upstream/develop' into develop
This commit is contained in:
commit
9f519002b1
|
@ -102,9 +102,7 @@ _libtaos.taos_get_client_info.restype = c_char_p
|
||||||
|
|
||||||
def taos_get_client_info():
|
def taos_get_client_info():
|
||||||
# type: () -> str
|
# type: () -> str
|
||||||
"""Get client version info.
|
"""Get client version info."""
|
||||||
获取客户端版本信息。
|
|
||||||
"""
|
|
||||||
return _libtaos.taos_get_client_info().decode()
|
return _libtaos.taos_get_client_info().decode()
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,6 +112,7 @@ _libtaos.taos_get_server_info.argtypes = (c_void_p,)
|
||||||
|
|
||||||
def taos_get_server_info(connection):
|
def taos_get_server_info(connection):
|
||||||
# type: (c_void_p) -> str
|
# type: (c_void_p) -> str
|
||||||
|
"""Get server version as string."""
|
||||||
return _libtaos.taos_get_server_info(connection).decode()
|
return _libtaos.taos_get_server_info(connection).decode()
|
||||||
|
|
||||||
|
|
||||||
|
@ -134,11 +133,10 @@ _libtaos.taos_connect.argtypes = c_char_p, c_char_p, c_char_p, c_char_p, c_uint1
|
||||||
def taos_connect(host=None, user="root", password="taosdata", db=None, port=0):
|
def taos_connect(host=None, user="root", password="taosdata", db=None, port=0):
|
||||||
# type: (None|str, str, str, None|str, int) -> c_void_p
|
# type: (None|str, str, str, None|str, int) -> c_void_p
|
||||||
"""Create TDengine database connection.
|
"""Create TDengine database connection.
|
||||||
创建数据库连接,初始化连接上下文。其中需要用户提供的参数包含:
|
|
||||||
|
|
||||||
- host: server hostname/FQDN, TDengine管理主节点的FQDN
|
- host: server hostname/FQDN
|
||||||
- user: user name/用户名
|
- user: user name
|
||||||
- password: user password / 用户密码
|
- password: user password
|
||||||
- db: database name (optional)
|
- db: database name (optional)
|
||||||
- port: server port
|
- port: server port
|
||||||
|
|
||||||
|
@ -187,11 +185,10 @@ _libtaos.taos_connect_auth.argtypes = c_char_p, c_char_p, c_char_p, c_char_p, c_
|
||||||
|
|
||||||
def taos_connect_auth(host=None, user="root", auth="", db=None, port=0):
|
def taos_connect_auth(host=None, user="root", auth="", db=None, port=0):
|
||||||
# type: (None|str, str, str, None|str, int) -> c_void_p
|
# type: (None|str, str, str, None|str, int) -> c_void_p
|
||||||
"""
|
"""Connect server with auth token.
|
||||||
创建数据库连接,初始化连接上下文。其中需要用户提供的参数包含:
|
|
||||||
|
|
||||||
- host: server hostname/FQDN, TDengine管理主节点的FQDN
|
- host: server hostname/FQDN
|
||||||
- user: user name/用户名
|
- user: user name
|
||||||
- auth: base64 encoded auth token
|
- auth: base64 encoded auth token
|
||||||
- db: database name (optional)
|
- db: database name (optional)
|
||||||
- port: server port
|
- port: server port
|
||||||
|
|
|
@ -21,7 +21,15 @@ import shutil
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from util.log import *
|
from util.log import *
|
||||||
|
|
||||||
|
def _parse_datetime(timestr):
|
||||||
|
try:
|
||||||
|
return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S.%f')
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
return datetime.datetime.strptime(timestr, '%Y-%m-%d %H:%M:%S')
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
class TDSql:
|
class TDSql:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -181,7 +189,7 @@ class TDSql:
|
||||||
tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" %
|
tdLog.info("sql:%s, row:%d col:%d data:%d == expect:%s" %
|
||||||
(self.sql, row, col, self.queryResult[row][col], data))
|
(self.sql, row, col, self.queryResult[row][col], data))
|
||||||
else:
|
else:
|
||||||
if self.queryResult[row][col] == datetime.datetime.fromisoformat(data):
|
if self.queryResult[row][col] == _parse_datetime(data):
|
||||||
tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" %
|
tdLog.info("sql:%s, row:%d col:%d data:%s == expect:%s" %
|
||||||
(self.sql, row, col, self.queryResult[row][col], data))
|
(self.sql, row, col, self.queryResult[row][col], data))
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue