root@8777afda5dc9:~# taos
Welcome to the TDengine Command Line Interface, Client Version:3.2.1.0
Copyright (c) 2023 by TDengine, all rights reserved.
******************************** Tab Completion ************************************
* The TDengine CLI supports tab completion for a variety of items, *
* including database names, table names, function names and keywords. *
* The full list of shortcut keys is as follows: *
* [ TAB ] ...... complete the current word *
* ...... if used on a blank line, display all supported commands *
* [ Ctrl + A ] ...... move cursor to the st[A]rt of the line *
* [ Ctrl + E ] ...... move cursor to the [E]nd of the line *
* [ Ctrl + W ] ...... move cursor to the middle of the line *
* [ Ctrl + L ] ...... clear the entire screen *
* [ Ctrl + K ] ...... clear the screen after the cursor *
* [ Ctrl + U ] ...... clear the screen before the cursor *
**************************************************************************************
Server is Community Edition.
taos>
taos CLI:
SELECT * FROM test2 where ts > '2023-06-01 00:00:00' and ts < '2023-06-30 23:59:59';
import pandas
from sqlalchemy import create_engine, text
engine = create_engine("taos://root:taosdata@127.0.0.1:6030/db")
conn = engine.connect()
df = pandas.read_sql(text("SELECT * FROM test2 where ts > '2023-06-01 00:00:00' and ts < '2023-06-30 23:59:59'"), conn)
conn.close()
# print index
print(df.index)
# print data type of element in ts column
print(type(df.ts[0]))
print(df.head(3))
TDengine-client-3.2.1.0-Windows-x64.exe (9.3 M)
sqlalchemy pip 下载,应该是最新版本
import pandas
from sqlalchemy import create_engine, text
engine = create_engine("taos://root:taosdata@127.0.0.1:6030/db")
conn = engine.connect()
df = pandas.read_sql(text("SELECT * FROM test2 where ts > '2023-06-01 00:00:00' and ts < '2023-06-30 23:59:59'"), conn)
conn.close()
# print index
print(df.index)
# print data type of element in ts column
print(type(df.ts[0]))
print(df.head(3))
# 两种方式都已尝试
#self.conndf = create_engine("taos://root:taosdata@127.0.0.1:6030/db").connect()
# self.conn = create_engine("taos://root:taosdata@localhost:6030/db").connect()
# self.conn = taos.connect(host="127.0.0.1", user="root",
# password="taosdata",
# database="db",
# port=6030,
# config="/etc/taos", # for windows the default value is C:\TDengine\cfg
# timezone="Asia/Shanghai") # default your host's timezone
Connected to pydev debugger (build 201.6668.113)
SELECT * FROM test2 where ts > '2023-06-30 23:55:00' and ts < '2023-06-30 23:59:59'
Empty DataFrame
Columns: [ts, test_1,...]
Index: []
Process finished with exit code 0
Issues
taos版本
taos CLI:
taos linux(ubuntu 20.04):
taos windows