Closed
Description
Specifications
- Client Version: 1.46.0
- InfluxDB Version:
- Platform:
Code sample to reproduce problem
TableList Typing is not working:
- just write (no need to execute) this in vscode, it may lead to a static linting error
bucket='MyBucket'
measurement='MyMeasurement'
field='MyField'
query=f'''
from(bucket: "{bucket}")
|> range(start:0)
|> filter(fn: (r) => r["_measurement"] == "{measurement}")
|> filter(fn: (r) => r["_field"] == "{field}")
|> last()
'''
client=InfluxDBClient(url, token, org)
query_api=client.query_api()
result=query_api.query(query)
MyValue=result[0].records[0].get_value() if result else False
MyTimestamp=result[0].records[0].get_time() if result else False
Expected behavior
Linting to work for:
- record field 'get_value()' or get_time()
Actual behavior
SOLUTION:
Add typing here:
# flux_table.py
class FluxTable(FluxStructure):
def __init__(self) -> None:
"""Initialize defaults."""
self.columns: List[FluxColumn] = [] #<<<<---- add this typing here
self.records: List[FluxRecord] = [] #<<<<---- add this typing here
Additional info
Thank you in advance