2022-05-21 03:11:57 +00:00
|
|
|
import taos
|
|
|
|
|
|
2024-08-01 13:07:55 +00:00
|
|
|
def create_connection():
|
2022-05-21 03:11:57 +00:00
|
|
|
# all parameters are optional.
|
2024-08-01 13:07:55 +00:00
|
|
|
conn = None
|
|
|
|
|
try:
|
2024-08-02 07:14:08 +00:00
|
|
|
conn = taos.connect(
|
2024-08-01 13:07:55 +00:00
|
|
|
user="root",
|
|
|
|
|
password="taosdata",
|
2024-08-02 07:14:08 +00:00
|
|
|
host="localhost",
|
2024-08-03 10:04:12 +00:00
|
|
|
port=6030,
|
2024-08-01 13:07:55 +00:00
|
|
|
)
|
|
|
|
|
except Exception as err:
|
2024-08-02 07:14:08 +00:00
|
|
|
print(err)
|
2024-08-01 13:07:55 +00:00
|
|
|
finally:
|
|
|
|
|
if conn:
|
|
|
|
|
conn.close()
|
|
|
|
|
|
2022-05-21 03:11:57 +00:00
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2024-08-01 13:07:55 +00:00
|
|
|
create_connection()
|