Record Module
Record module
Record​
@dataclass
class Record()
Record in a query
timestamp​
UNIX timestamp in microseconds
size​
size of data
last​
last record in the query. Deprecated: doesn't work for some cases
content_type​
content type of data
read_all​
read all data
read​
read data in chunks where each chunk has size less than or equal to n
labels​
labels of record
get_datetime​
def get_datetime() -> datetime
Get timestamp of record as datetime
Returns:
datetime
- timestamp as datetime
Batch​
class Batch()
Batch of records to write them in one request
add​
def add(timestamp: Union[int, datetime, float, str],
data: bytes = b"",
content_type: Optional[str] = None,
labels: Optional[Dict[str, str]] = None)
Add record to batch
Arguments:
timestamp
- timestamp of record. int (UNIX timestamp in microseconds), datetime, float (UNIX timestamp in seconds), str (ISO 8601 string)data
- data to storecontent_type
- content type of data (default: application/octet-stream)labels
- labels of record (default: )
items​
def items() -> List[Tuple[int, Record]]
Get records as dict items
size​
@property
def size() -> int
Get size of data in batch
last_access​
@property
def last_access() -> float
Get last access time of batch. Can be used for sending by timeout
clear​
def clear()
Clear batch
parse_record​
def parse_record(resp: ClientResponse, last=True) -> Record
Parse record from response
parse_batched_records​
async def parse_batched_records(resp: ClientResponse) -> AsyncIterator[Record]
Parse batched records from response