U
vi$ @ s d Z ddlZddlZddlmZ ddlmZ ddlmZm Z ddl
mZ G dd dZG d d
d
eZ
G dd deZG d
d deZG dd deZG dd dee ZG dd de ee ZdS )zt
Flux employs a basic data model built from basic data types.
The data model consists of tables, records, columns.
N)HTTPResponse)JSONEncoder)ListIterator)_UTF_8_encodingc @ s e Zd ZdZdS )
FluxStructurez4The data model consists of tables, records, columns.N)__name__
__module____qualname____doc__ r r R/opt/alt/python38/lib/python3.8/site-packages/influxdb_client/client/flux_table.pyr s r c s e Zd ZdZ fddZ ZS )FluxStructureEncoderz:The FluxStructure encoder to encode query results to JSON.c s> ddl }t|tr|jS t||j |jfr2| S t |S )z,Return serializable objects for JSONEncoder.r N)datetime
isinstancer __dict__date isoformatsuperdefault)selfobjr __class__r r
r s
zFluxStructureEncoder.default)r r r
r r
__classcell__r r r r
r s r c @ s> e Zd ZdZddddZdd Zdd Zd
d Zdd
ZdS ) FluxTableaA
A table is set of records with a common set of columns and a group key.
The table can be serialized into JSON by::
import json
from influxdb_client.client.flux_table import FluxStructureEncoder
output = json.dumps(tables, cls=FluxStructureEncoder, indent=2)
print(output)
Nreturnc C s g | _ g | _dS zInitialize defaults.N)columnsrecordsr r r r
__init__/ s zFluxTable.__init__c C s t tdd | jS )u
Group key is a list of columns.
A table’s group key denotes which subset of the entire dataset is assigned to the table.
c S s
| j dkS )NT)group)columnr r r