Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add chapter number in table doc-en #617

Merged
merged 1 commit into from
Feb 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/UserGuide/Master/Table/API/Programming-JDBC_timecho.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,20 @@
under the License.

-->
# JDBC

The IoTDB JDBC provides a standardized way to interact with the IoTDB database, allowing users to execute SQL statements from Java programs for managing databases and time-series data. It supports operations such as connecting to the database, creating, querying, updating, and deleting data, as well as batch insertion and querying of time-series data.

**Note:** The current JDBC implementation is designed primarily for integration with third-party tools. High-performance writing **may not be achieved** when using JDBC for insert operations. For Java applications, it is recommended to use the **JAVA Native API** for optimal performance.

## Prerequisites
## 1. Prerequisites

### **Environment Requirements**
### 1.1 **Environment Requirements**

- **JDK:** Version 1.8 or higher
- **Maven:** Version 3.6 or higher

### **Adding Maven Dependencies**
### 1.2 **Adding Maven Dependencies**

Add the following dependency to your Maven `pom.xml` file:

Expand All @@ -44,13 +45,13 @@ Add the following dependency to your Maven `pom.xml` file:
</dependencies>
```

## Read and Write Operations
## 2. Read and Write Operations

**Write Operations:** Perform database operations such as inserting data, creating databases, and creating time-series using the `execute` method.

**Read Operations:** Execute queries using the `executeQuery` method and retrieve results via the `ResultSet` object.

### Method Overview
### 2.1 Method Overview

| **Method Name** | **Description** | **Parameters** | **Return Value** |
| ------------------------------------------------------------ | ----------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------- |
Expand All @@ -63,7 +64,7 @@ Add the following dependency to your Maven `pom.xml` file:
| ResultSet.next() | Moves to the next row in the result set | None | `boolean`: Whether the move was successful |
| ResultSet.getString(int columnIndex) | Retrieves the string value of a specified column | `columnIndex`: Column index (starting from 1) | `String`: Column value |

## Sample Code
## 3. Sample Code

**Note:** When using the Table Model, you must specify the `sql_dialect` parameter as `table` in the URL. Example:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@
under the License.

-->
# Java Native API

IoTDB provides a Java native client driver and a session pool management mechanism. These tools enable developers to interact with IoTDB using object-oriented APIs, allowing time-series objects to be directly assembled and inserted into the database without constructing SQL statements. It is recommended to use the `ITableSessionPool` for multi-threaded database operations to maximize efficiency.

## Prerequisites
## 1. Prerequisites

### Environment Requirements
### 1.1 Environment Requirements

- **JDK**: Version 1.8 or higher
- **Maven**: Version 3.6 or higher

### Adding Maven Dependencies
### 1.2 Adding Maven Dependencies

```XML
<dependencies>
Expand All @@ -40,9 +41,9 @@ IoTDB provides a Java native client driver and a session pool management mechani
</dependencies>
```

## Read and Write Operations
## 2. Read and Write Operations

### ITableSession Interface
### 2.1 ITableSession Interface

The `ITableSession` interface defines basic operations for interacting with IoTDB, including data insertion, query execution, and session closure. Note that this interface is **not thread-safe**.

Expand Down Expand Up @@ -124,7 +125,7 @@ public interface ITableSession extends AutoCloseable {
}
```

### TableSessionBuilder Class
### 2.2 TableSessionBuilder Class

The `TableSessionBuilder` class is a builder for configuring and creating instances of the `ITableSession` interface. It allows developers to set connection parameters, query parameters, and security features.

Expand Down Expand Up @@ -336,9 +337,9 @@ public class TableSessionBuilder {
}
```

## Session Pool
## 3. Session Pool

### ITableSessionPool Interface
### 3.1 ITableSessionPool Interface

The `ITableSessionPool` interface manages a pool of `ITableSession` instances, enabling efficient reuse of connections and proper cleanup of resources.

Expand Down Expand Up @@ -378,7 +379,7 @@ public interface ITableSessionPool {
}
```

### TableSessionPoolBuilder Class
### 3.2 ableSessionPoolBuilder Class

The `TableSessionPoolBuilder` class is a builder for configuring and creating `ITableSessionPool` instances, supporting options like connection settings and pooling behavior.

Expand Down
17 changes: 9 additions & 8 deletions src/UserGuide/Master/Table/API/Programming-Python-Native-API.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@
under the License.

-->
# Python Native API

IoTDB provides a Python native client driver and a session pool management mechanism. These tools allow developers to interact with IoTDB in a programmatic and efficient manner. Using the Python API, developers can encapsulate time-series data into objects (e.g., `Tablet`, `NumpyTablet`) and insert them into the database directly, without the need to manually construct SQL statements. For multi-threaded operations, the `TableSessionPool` is recommended to optimize resource utilization and enhance performance.

## Prerequisites
## 1. Prerequisites

To use the IoTDB Python API, install the required package using pip:

```Java
pip3 install apache-iotdb
```

## Read and Write Operations
## 2. Read and Write Operations

### TableSession
### 2.1 TableSession

`TableSession` is a core class in IoTDB, enabling users to interact with the IoTDB database. It provides methods to execute SQL statements, insert data, and manage database sessions.

Expand Down Expand Up @@ -101,7 +102,7 @@ def close(self):
pass
```

### TableSessionConfig
### 2.2 TableSessionConfig

`TableSessionConfig` is a configuration class that sets parameters for creating a `TableSession` instance, defining essential settings for connecting to the IoTDB database.

Expand Down Expand Up @@ -159,9 +160,9 @@ class TableSessionConfig(object):

**Note:** After using a `TableSession`, make sure to call the `close` method to release resources.

## Session Pool
## 3. Session Pool

### TableSessionPool
### 3.1 TableSessionPool

`TableSessionPool` is a session pool management class designed for creating and managing `TableSession` instances. It provides functionality to retrieve sessions from the pool and close the pool when it is no longer needed.

Expand Down Expand Up @@ -200,7 +201,7 @@ def close(self):
"""
```

### TableSessionPoolConfig
### 3.2 TableSessionPoolConfig

`TableSessionPoolConfig` is a configuration class used to define parameters for initializing and managing a `TableSessionPool` instance. It specifies the settings needed for efficient session pool management in IoTDB.

Expand Down Expand Up @@ -276,7 +277,7 @@ class TableSessionPoolConfig(object):
- Ensure that `TableSession` instances retrieved from the `TableSessionPool` are properly closed after use.
- After closing the `TableSessionPool`, it will no longer be possible to retrieve new sessions.

## Sample Code
## 4. Sample Code

**Session** Example: You can find the full example code at [GitHub Repository](https://github.com/apache/iotdb/blob/master/iotdb-client/client-py/table_model_session_example.py).

Expand Down
87 changes: 44 additions & 43 deletions src/UserGuide/Master/Table/API/RestAPI-V1.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@
under the License.

-->
# RestAPI V1

IoTDB's RESTful service can be used for querying, writing, and management operations. It uses the OpenAPI standard to define interfaces and generate frameworks.

### Enabling RESTful Service
## 1. Enabling RESTful Service

The RESTful service is disabled by default. To enable it, locate the `conf/iotdb-system.properties` file in the IoTDB installation directory, set `enable_rest_service` to `true`, and then restart the datanode process.

```Properties
enable_rest_service=true
```

### Authentication
## 2. Authentication

Except for the health check endpoint `/ping`, the RESTful service uses basic authentication. Each URL request must include the header `'Authorization':'Basic' + base64.encode(username + ':' + password)`.

Expand Down Expand Up @@ -59,9 +60,9 @@ Authorization : Basic cm9vdDpyb290
{"code":800,"message":"INIT_AUTH_ERROR"}
```

### Interface Definitions
## 3. Interface Definitions

#### Ping
### 3.1 Ping

The `/ping` endpoint can be used for online service health checks.

Expand All @@ -71,9 +72,9 @@ The `/ping` endpoint can be used for online service health checks.

- Example Request:

```Shell
```Bash
curl http://127.0.0.1:18080/ping
```
```

- HTTP Status Codes:

Expand Down Expand Up @@ -102,7 +103,7 @@ The `/ping` endpoint can be used for online service health checks.

**Note**: The `/ping` endpoint does not require authentication.

#### Query Interface
### 3.2 Query Interface

- Request Path: `/rest/table/v1/query`

Expand Down Expand Up @@ -130,9 +131,9 @@ The `/ping` endpoint can be used for online service health checks.

- Example Request:

```JSON
```Bash
curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"database":"test","sql":"select s1,s2,s3 from test_table"}' http://127.0.0.1:18080/rest/table/v1/query
```
```

- Example Response:

Expand Down Expand Up @@ -161,9 +162,9 @@ The `/ping` endpoint can be used for online service health checks.
]
]
}
```
```

#### Non-Query Interface
### 3.3 Non-Query Interface

- Request Path: `/rest/table/v1/nonQuery`

Expand Down Expand Up @@ -208,9 +209,9 @@ The `/ping` endpoint can be used for online service health checks.
"code": 200,
"message": "SUCCESS_STATUS"
}
```
```

#### Batch Write Interface
### 3.4 Batch Write Interface

- Request Path: `/rest/table/v1/insertTablet`

Expand Down Expand Up @@ -241,9 +242,9 @@ The `/ping` endpoint can be used for online service health checks.

- Example Request:

```JSON
```Bash
curl -H "Content-Type:application/json" -H "Authorization:Basic cm9vdDpyb290" -X POST --data '{"database":"test","column_catogories":["TAG","FIELD","FIELD"],"timestamps":[1739702535000,1739789055000],"column_names":["s1","s2","s3"],"data_types":["STRING","BOOLEAN","INT32"],"values":[["a11",true,2024],["a11",false,2025]],"table":"test_table"}' http://127.0.0.1:18080/rest/table/v1/insertTablet
```
```

- Example Response:

Expand All @@ -252,86 +253,86 @@ The `/ping` endpoint can be used for online service health checks.
"code": 200,
"message": "SUCCESS_STATUS"
}
```
```

### Configuration
## 4. Configuration

The configuration file is located in `iotdb-system.properties`.

- Set `enable_rest_service` to `true` to enable the module, or `false` to disable it. The default value is `false`.

```Plain
```Properties
enable_rest_service=true
```
```

- Only effective when `enable_rest_service=true`. Set `rest_service_port` to a number (1025~65535) to customize the REST service socket port. The default value is `18080`.

```Plain
```Properties
rest_service_port=18080
```
```

- Set `enable_swagger` to `true` to enable Swagger for displaying REST interface information, or `false` to disable it. The default value is `false`.

```Plain
```Properties
enable_swagger=false
```
```

- The maximum number of rows that can be returned in a single query. If the result set exceeds this limit, only the rows within the limit will be returned, and status code `411` will be returned.

```Plain
```Properties
rest_query_default_row_size_limit=10000
```
```

- Expiration time for caching client login information (used to speed up user authentication, in seconds, default is 8 hours).

```Plain
```Properties
cache_expire_in_seconds=28800
```
```

- Maximum number of users stored in the cache (default is 100).

```Plain
```Properties
cache_max_num=100
```
```

- Initial cache capacity (default is 10).

```Plain
```Properties
cache_init_num=10
```
```

- Whether to enable SSL configuration for the REST service. Set `enable_https` to `true` to enable it, or `false` to disable it. The default value is `false`.

```Plain
```Properties
enable_https=false
```
```

- Path to the `keyStore` (optional).

```Plain
```Properties
key_store_path=
```
```

- Password for the `keyStore` (optional).

```Plain
```Properties
key_store_pwd=
```
```

- Path to the `trustStore` (optional).

```Plain
```Properties
trust_store_path=""
```
```

- Password for the `trustStore` (optional).

```Plain
```Properties
trust_store_pwd=""
```
```

- SSL timeout time, in seconds.

```Plain
```Properties
idle_timeout_in_seconds=5000
```
```
Loading