Skip to content

Commit

Permalink
fix: add pandas-read-sql-tdengine-cloud.py (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
sangshuduo authored Feb 23, 2023
1 parent 4d88410 commit 297e0a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/pandas-read-sql-tdengine-cloud.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import os
import pandas
from sqlalchemy import create_engine, text

url = os.environ["TDENGINE_CLOUD_URL"]
token = os.environ["TDENGINE_CLOUD_TOKEN"]
url = url.replace("https", "")

engine = create_engine(f"taosws{url}?token={token}")
conn = engine.connect()
res = pandas.read_sql(text("show databases"), conn)
conn.close()
print(res)

0 comments on commit 297e0a3

Please sign in to comment.