TDengine/docs/examples/python/query_rest.py

16 lines
399 B
Python
Raw Normal View History

2024-08-02 08:20:50 +00:00
import taosrest
client = None
try:
client = taosrest.RestClient(url="http://localhost:6041",
user="root",
password="taosdata",
timeout=30)
2024-08-03 13:58:17 +00:00
result = client.sql(f"SELECT ts, current, location FROM power.meters limit 100", 1)
2024-08-02 08:20:50 +00:00
print(result)
except Exception as err:
2024-08-03 13:58:17 +00:00
print(f"Failed to query data from power.meters, err:{err}")