Merge branch 'docs/sheyj-3.0' of github.com:taosdata/TDengine into docs/sheyj-3.0
This commit is contained in:
commit
85e6492ac4
|
@ -62,7 +62,7 @@ async function subscribe(consumer) {
|
|||
for (let [key, value] of res) {
|
||||
console.log(`data: ${key} ${value}`);
|
||||
}
|
||||
consumer.commit();
|
||||
await consumer.commit();
|
||||
console.log("Commit offset manually successfully.");
|
||||
}
|
||||
} catch (err) {
|
||||
|
@ -77,7 +77,7 @@ async function test() {
|
|||
let consumer = null;
|
||||
try {
|
||||
await prepare();
|
||||
let consumer = await createConsumer()
|
||||
consumer = await createConsumer()
|
||||
await subscribe(consumer)
|
||||
await consumer.unsubscribe();
|
||||
console.log("Consumer unsubscribed successfully.");
|
||||
|
|
|
@ -31,7 +31,7 @@ async function prepare() {
|
|||
conf.setUser('root');
|
||||
conf.setPwd('taosdata');
|
||||
conf.setDb('power');
|
||||
const createDB = `CREATE DATABASE IF NOT EXISTS POWER ${db} KEEP 3650 DURATION 10 BUFFER 16 WAL_LEVEL 1;`;
|
||||
const createDB = `CREATE DATABASE IF NOT EXISTS ${db} KEEP 3650 DURATION 10 BUFFER 16 WAL_LEVEL 1;`;
|
||||
const createStable = `CREATE STABLE IF NOT EXISTS ${db}.${stable} (ts timestamp, current float, voltage int, phase float) TAGS (location binary(64), groupId int);`;
|
||||
|
||||
let wsSql = await taos.sqlConnect(conf);
|
||||
|
@ -45,7 +45,7 @@ async function prepare() {
|
|||
for (let i = 0; i < 10; i++) {
|
||||
await wsSql.exec(`INSERT INTO d1001 USING ${stable} (location, groupId) TAGS ("California.SanFrancisco", 3) VALUES (NOW, ${10 + i}, ${200 + i}, ${0.32 + i})`);
|
||||
}
|
||||
wsSql.Close();
|
||||
await wsSql.close();
|
||||
}
|
||||
|
||||
// ANCHOR: subscribe
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
import taosws
|
||||
|
||||
host = "localhost"
|
||||
port = 6041
|
||||
def prepare():
|
||||
conn = None
|
||||
try:
|
||||
conn = taosws.connect(user="root",
|
||||
password="taosdata",
|
||||
host="localhost",
|
||||
port=6041)
|
||||
host=host,
|
||||
port=port)
|
||||
|
||||
# create database
|
||||
rowsAffected = conn.execute(f"CREATE DATABASE IF NOT EXISTS power")
|
||||
assert rowsAffected == 0
|
||||
|
||||
except Exception as err:
|
||||
print(f"Failed to create db and table, err:{err}")
|
||||
print(f"Failed to create db and table, db addrr:{host}:{port} ; ErrMessage:{err}")
|
||||
raise err
|
||||
finally:
|
||||
if conn:
|
||||
|
@ -32,8 +34,7 @@ def schemaless_insert():
|
|||
jsonDemo = [
|
||||
'{"metric": "metric_json","timestamp": 1626846400,"value": 10.3, "tags": {"groupid": 2, "location": "California.SanFrancisco", "id": "d1001"}}'
|
||||
]
|
||||
host = "localhost"
|
||||
port = 6041
|
||||
|
||||
try:
|
||||
conn = taosws.connect(user="root",
|
||||
password="taosdata",
|
||||
|
@ -76,6 +77,6 @@ def schemaless_insert():
|
|||
if __name__ == "__main__":
|
||||
try:
|
||||
prepare()
|
||||
schemaless_insert
|
||||
schemaless_insert()
|
||||
except Exception as err:
|
||||
print(f"Failed to insert data with schemaless, err:{err}")
|
||||
|
|
|
@ -7,8 +7,8 @@ numOfRow = 10
|
|||
|
||||
conn = None
|
||||
stmt = None
|
||||
host="localhost",
|
||||
port=6030,
|
||||
host="localhost"
|
||||
port=6030
|
||||
try:
|
||||
conn = taos.connect(
|
||||
user="root",
|
||||
|
|
|
@ -13,8 +13,8 @@ port=6041
|
|||
try:
|
||||
conn = taosws.connect(user="root",
|
||||
password="taosdata",
|
||||
host="localhost",
|
||||
port=6041)
|
||||
host=host,
|
||||
port=port)
|
||||
|
||||
conn.execute("CREATE DATABASE IF NOT EXISTS power")
|
||||
conn.execute("USE power")
|
||||
|
|
|
@ -50,7 +50,7 @@ from taos.tmq import Consumer
|
|||
|
||||
def create_consumer():
|
||||
host = "localhost"
|
||||
port = 6030
|
||||
port = "6030"
|
||||
groupId = "group1"
|
||||
clientId = "1"
|
||||
try:
|
||||
|
|
|
@ -146,7 +146,7 @@ Note: 从 3.0.1.7 开始,只提供 TDengine 客户端的 Windows 客户端的
|
|||
</Tabs>
|
||||
|
||||
:::info
|
||||
下载其他组件、最新 Beta 版及之前版本的安装包,请点击[发布历史页面](../../releases/tdengine)。
|
||||
下载其他组件、最新 Beta 版及之前版本的安装包,请点击[发布历史页面](https://docs.taosdata.com/releases/tdengine/)。
|
||||
:::
|
||||
|
||||
:::note
|
||||
|
|
Loading…
Reference in New Issue