docs: update english documents

This commit is contained in:
Alex Duan 2024-12-30 17:53:28 +08:00
parent 62d3df49d1
commit e823212965
2 changed files with 37 additions and 46 deletions

View File

@ -55,6 +55,8 @@ Python Connector historical versions (it is recommended to use the latest versio
|Python Connector Version | Major Changes | TDengine Version| |Python Connector Version | Major Changes | TDengine Version|
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|2.7.20 | Native supports STMT2 writing | - |
|2.7.19 | Support Apache Superset connection to TDengine Cloud data source | - |
|2.7.18 | Support Apache SuperSet BI Tools. | - | |2.7.18 | Support Apache SuperSet BI Tools. | - |
|2.7.16 | Add subscription configuration (session. timeout. ms, Max. roll. interval. ms). | - | |2.7.16 | Add subscription configuration (session. timeout. ms, Max. roll. interval. ms). | - |
|2.7.15 | Added support for VARBINRY and GEOMETRY types. | - | |2.7.15 | Added support for VARBINRY and GEOMETRY types. | - |
@ -136,7 +138,7 @@ TDengine currently supports timestamp, numeric, character, boolean types, and th
| [tmq_consumer.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/tmq_consumer.py) | tmq subscription | | [tmq_consumer.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/tmq_consumer.py) | tmq subscription |
| [native_all_type_query.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_query.py) | Example supporting all types | | [native_all_type_query.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_query.py) | Example supporting all types |
| [native_all_type_stmt.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_stmt.py) | Parameter binding example supporting all types | | [native_all_type_stmt.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_stmt.py) | Parameter binding example supporting all types |
| [test_stmt2.py](https://github.com/taosdata/taos-connector-python/blob/main/tests/test_stmt2.py) | Example of STMT2 writing |
Example program source code can be found at: Example program source code can be found at:
1. [More native example programs](https://github.com/taosdata/taos-connector-python/tree/main/examples) 1. [More native example programs](https://github.com/taosdata/taos-connector-python/tree/main/examples)
@ -429,51 +431,40 @@ TaosResult object can be iterated over to retrieve queried data.
- **Exceptions**: Throws `SchemalessError` if operation fails. - **Exceptions**: Throws `SchemalessError` if operation fails.
#### Parameter Binding #### Parameter Binding
- `def statement2(self, sql=None, option=None)`
- `def statement(self, sql=None)` - **Interface Description**Creating an STMT2 object using a connection object
- **Interface Description**: Creates a stmt object using the connection object, if sql is not empty it will call prepare. - **Parameter Description**
- `sql`: Precompiled SQL statement. - `sql`: The bound SQL statement will call the `prepare` function if it is not empty
- **Return Value**: stmt object. - `option` Pass in TaoStmt2Option class instance options
- **Exception**: Throws `StatementError` exception on failure. - **Return Value**stmt2 object
- **Exception**Throws `ConnectionError` on failure
- `def prepare(self, sql)` - `def prepare(self, sql)`
- **Interface Description**: Binds a precompiled sql statement. - **Interface Description**Bind a precompiled SQL statement
- **Parameter Description**: - **Parameter Description**
- `sql`: Precompiled SQL statement. - `sql`: Precompiled SQL statement
- **Exception**: Throws `StatementError` exception on failure. - **Exception**Throws `StatementError` on failure
- `def set_tbname(self, name)` - `def bind_param(self, tbnames, tags, datas)`
- **Interface Description**: Sets the table name for data to be written to. - **Interface Description**Binding Data as an Independent Array
- **Parameter Description**: - **Parameter Description**
- `name`: Table name, if you need to specify a database, for example: `db_name.table_name`. - `tbnames`:Bind table name array, data type is list
- **Exception**: Throws `StatementError` exception on failure. - `tags`: Bind tag column value array, data type is list
- `def set_tbname_tags(self, name, tags):` - `tags`: Bind a regular column value array with a data type of list
- **Interface Description**: Sets the table and Tags data, used for automatic table creation. - **Exception**Throws `StatementError` on failure
- **Parameter Description**: - `def bind_param_with_tables(self, tables)`
- `name`: Table name, if you need to specify a database, for example: `db_name.table_name`. - **Interface Description**Bind data in an independent table format. Independent tables are organized by table units, with table names, TAG values, and regular column numerical attributes in each table
- `tags`: Tags data. - **Parameter Description**
- **Exception**: Throws `StatementError` exception on failure. - `tables`: `BindTable` Independent Table Object Array
- `def bind_param(self, params, add_batch=True)` - **Exception**Throws `StatementError` on failure
- **Interface Description**: Binds a set of data and submits. - `def execute(self) -> int:`
- **Parameter Description**: - **Interface Description**Execute to write all bound data
- `params`: Data to bind. - **Return Value**Affects the number of rows
- `add_batch`: Whether to submit the bound data. - **Exception**Throws `QueryError` on failure
- **Exception**: Throws `StatementError` exception on failure. - `def result(self)`
- `def bind_param_batch(self, binds, add_batch=True)` - **Interface Description**Get parameter binding query result set
- **Interface Description**: Binds multiple sets of data and submits. - **Return Value**Returns the TaosResult object
- **Parameter Description**: - `def close(self)`
- `binds`: Data to bind. - **Interface Description** close the STMT2 object
- `add_batch`: Whether to submit the bound data.
- **Exception**: Throws `StatementError` exception on failure.
- `def add_batch(self)`
- **Interface Description**: Submits the bound data.
- **Exception**: Throws `StatementError` exception on failure.
- `def execute(self)`
- **Interface Description**: Executes and writes all the bound data.
- **Exception**: Throws `StatementError` exception on failure.
- `def affected_rows(self)`
- **Interface Description**: Gets the number of rows written.
- **Return Value**: Number of rows written.
- `def close(&self)`
- **Interface Description**: Closes the stmt object.
#### Data Subscription #### Data Subscription

View File

@ -134,7 +134,7 @@ TDengine 目前支持时间戳、数字、字符、布尔类型,与 Python 对
| [tmq_consumer.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/tmq_consumer.py) | tmq 订阅 | | [tmq_consumer.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/tmq_consumer.py) | tmq 订阅 |
| [native_all_type_query.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_query.py) | 支持全部类型示例 | | [native_all_type_query.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_query.py) | 支持全部类型示例 |
| [native_all_type_stmt.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_stmt.py) | 参数绑定 stmt 全部类型示例 | | [native_all_type_stmt.py](https://github.com/taosdata/taos-connector-python/blob/main/examples/native_all_type_stmt.py) | 参数绑定 stmt 全部类型示例 |
| [insert_with_stmt2.py](https://github.com/taosdata/taos-connector-python/blob/main/tests/test_stmt2.py) | 参数绑定 stmt2 写入示例 | | [test_stmt2.py](https://github.com/taosdata/taos-connector-python/blob/main/tests/test_stmt2.py) | 参数绑定 stmt2 写入示例 |
示例程序源码请参考: 示例程序源码请参考: