Skip to content

Commit

Permalink
Fix parsing of results from TDEngine DESCRIBE [1.7.x] (#541)
Browse files Browse the repository at this point in the history
  • Loading branch information
gtopper authored Sep 30, 2024
1 parent 9fe74bc commit ed00a42
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
24 changes: 14 additions & 10 deletions storey/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from datetime import datetime, timezone
from enum import Enum
from typing import Callable, List, Literal, NamedTuple, Optional, Union
from typing import Callable, List, Optional, Union

import numpy

Expand Down Expand Up @@ -456,12 +456,16 @@ class FixedWindowType(Enum):
LastClosedWindow = 2


class _TDEngineField(NamedTuple):
field: str
# https://docs.tdengine.com/reference/taos-sql/data-type/
type: Literal["TIMESTAMP", "INT", "FLOAT", "DOUBLE", "BINARY", "BOOL", "NCHAR", "JSON", "VARCHAR"]
length: int
note: Literal["", "TAG"]
encode: str
compress: str
level: str
class _TDEngineField:
def __init__(
self,
field: str,
field_type: str,
length: int,
note: str,
*args,
):
self.field = field
self.field_type = field_type
self.length = length
self.note = note
2 changes: 1 addition & 1 deletion storey/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def _get_table_schema(
reg_cols_schema = []
for field in fields:
field_name = field.field
field_type = field.type
field_type = field.field_type

if field.note == "TAG":
if field_type in self._tdengine_type_to_tag_func:
Expand Down

0 comments on commit ed00a42

Please sign in to comment.