types.py 748 字节
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
from typing import Any, List, Dict, NewType
from enum import Enum

DirPath = NewType('DirPath', str)

QueryResult = NewType('QueryResult', List[List[Any]])

class TdDataType(Enum):
    '''
    Use a Python Enum types of represent all the data types in TDengine.

    Ref: https://www.taosdata.com/cn/documentation/taos-sql#data-type
    '''
    TIMESTAMP = 'TIMESTAMP'
    INT       = 'INT'
    BIGINT    = 'BIGINT'
    FLOAT     = 'FLOAT'
    DOUBLE    = 'DOUBLE'
    BINARY    = 'BINARY'
    BINARY16  = 'BINARY(16)'  # TODO: get rid of this hack
    BINARY200 = 'BINARY(200)'
    SMALLINT  = 'SMALLINT'
    TINYINT   = 'TINYINT'
    BOOL      = 'BOOL'
    NCHAR     = 'NCHAR'

TdColumns = Dict[str, TdDataType]
TdTags    = Dict[str, TdDataType]