-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathpython.sh
More file actions
221 lines (164 loc) · 4.01 KB
/
python.sh
File metadata and controls
221 lines (164 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
#!/bin/bash
set -e
check_transactions() {
for i in {1..30}
do
output=$(taos -s "show transactions;")
if [[ $output == *"Query OK, 0 row(s)"* ]]; then
echo "Success: No transactions are in progress."
return 0
fi
sleep 1
done
echo "Error: Transactions are still in progress after 30 attempts."
return 1
}
reset_cache() {
response=$(curl --location -uroot:taosdata 'http://127.0.0.1:6041/rest/sql' --data 'reset query cache')
if [[ $response == \{\"code\":0* ]]; then
echo "Success: Query cache reset successfully."
else
echo "Error: Failed to reset query cache. Response: $response"
return 1
fi
}
taosd >>/dev/null 2>&1 &
taosadapter >>/dev/null 2>&1 &
sleep 10
cd ../../docs/examples/python
# 1
taos -s "create database if not exists log"
check_transactions || exit 1
reset_cache || exit 1
python3 connect_example.py
# 2
taos -s "drop database if exists power"
check_transactions || exit 1
reset_cache || exit 1
python3 native_insert_example.py
# 3
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
python3 bind_param_example.py
# 4
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
python3 multi_bind_example.py
# 5
python3 query_example.py
# 6
python3 async_query_example.py
# 7
taos -s "drop database if exists test"
check_transactions || exit 1
reset_cache || exit 1
python3 line_protocol_example.py
# 8
taos -s "drop database test"
check_transactions || exit 1
reset_cache || exit 1
python3 telnet_line_protocol_example.py
# 9
taos -s "drop database test"
check_transactions || exit 1
reset_cache || exit 1
python3 json_protocol_example.py
# 10
pip install SQLAlchemy
pip install pandas
taosBenchmark -y -d power -t 10 -n 10
check_transactions || exit 1
reset_cache || exit 1
python3 conn_native_pandas.py
python3 conn_rest_pandas.py
taos -s "drop database if exists power"
# 11
taos -s "create database if not exists test wal_retention_period 3600"
python3 connect_native_reference.py
# 12
python3 connect_rest_examples.py
# 13
python3 handle_exception.py
# 14
taosBenchmark -y -d power -t 2 -n 10
python3 rest_client_example.py
taos -s "drop database if exists power"
# 15
python3 result_set_examples.py
# 16
python3 tmq_example.py
# 17
python3 sql_writer.py
# 18
python3 mockdatasource.py
# 19
python3 fast_write_example.py
# 20
pip3 install kafka-python==2.1.2
python3 kafka_example_consumer.py
# 21
pip3 install taos-ws-py==0.6.6
python3 conn_websocket_pandas.py
# 22
python3 connect_websocket_examples.py
# 23
python3 connect_websocket_sqlalchemy_examples.py
# 24
pip3 install DBUtils==3.1.1
python3 dbutils_demo.py
# 25
python3 create_db_ws.py
# 26
python3 create_db_native.py
# 27
python3 create_db_rest.py
pip3 install SQLAlchemy==2.0.43
python3 sqlalchemy_demo.py
python3 insert_native.py
python3 insert_rest.py
python3 insert_ws.py
python3 query_native.py
python3 query_rest.py
python3 query_ws.py
python3 reqid_native.py
python3 reqid_rest.py
python3 reqid_ws.py
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
python3 schemaless_native.py
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
python3 schemaless_ws.py
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
python3 stmt_native.py
python3 stmt_ws.py
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
echo "stmt2_native.py"
python3 stmt2_native.py
taos -s "drop database power"
check_transactions || exit 1
reset_cache || exit 1
echo "stmt2_ws.py"
python3 stmt2_ws.py
taos -s "drop topic if exists topic_meters"
check_transactions || exit 1
reset_cache || exit 1
taos -s "drop database if exists power"
check_transactions || exit 1
reset_cache || exit 1
python3 tmq_native.py
taos -s "drop topic if exists topic_meters"
check_transactions || exit 1
reset_cache || exit 1
taos -s "drop database if exists power"
check_transactions || exit 1
reset_cache || exit 1
python3 tmq_websocket_example.py