From a9b11ffc7b31ebf73f307fdba735364b675ed5e5 Mon Sep 17 00:00:00 2001 From: Linhe Huo Date: Wed, 19 Oct 2022 17:05:23 +0800 Subject: [PATCH] docs: add example code and syntax instruction for python subscription (#17479) Ref: [TD-19654](https://jira.taosdata.com:18080/browse/TD-19654) --- docs/zh/07-develop/07-tmq.mdx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/zh/07-develop/07-tmq.mdx b/docs/zh/07-develop/07-tmq.mdx index a617935bbf..1f5a089aaa 100644 --- a/docs/zh/07-develop/07-tmq.mdx +++ b/docs/zh/07-develop/07-tmq.mdx @@ -420,7 +420,18 @@ let mut consumer = tmq.build()?; -Python 使用以下配置项创建一个 Consumer 实例。 +Python 语言下引入 `taos` 库的 `TaosConsumer` 类,创建一个 Consumer 示例: + +```python +from taos.tmq import TaosConsumer + +# Syntax: `consumer = TaosConsumer(*topics, **args)` +# +# Example: +consumer = TaosConsumer('topic1', 'topic2', td_connect_ip = "127.0.0.1", group_id = "local") +``` + +其中,元组类型参数被视为 *Topics*,字典类型参数用于以下订阅配置设置: | 参数名称 | 类型 | 参数说明 | 备注 | | :----------------------------: | :----: | -------------------------------------------------------- | ------------------------------------------- | -- GitLab