Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

Commit bdde8d3

Browse files
authored
chore: update usage of latest python sdk (#54)
1 parent ccd940f commit bdde8d3

6 files changed

Lines changed: 26 additions & 14 deletions

File tree

docs/src/cn/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# 技术系列文章
5353

5454
- [整体架构](design/architecture.md)
55-
- [集群](design/clustering.md)
55+
- [集群](design/cluster.md)
5656
- [存储](design/storage.md)
5757
- [WAL](design/wal.md)
5858
- [WAL on RocksDB](design/wal_on_rocksdb.md)

docs/src/cn/design/storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CeresDB 是一种基于 share-nothing 架构的分布式存储系统,不同服
2222

2323
由于 memtable 不是实时持久化到底层存储系统,因此需要用 WAL 来保证 memtable 中数据的可靠性。
2424

25-
另一方面,由于[分布式架构](clustering.md)的设计,要求 WAL 本身是高可用的,现在 CeresDB 中,主要有以下几种实现:
25+
另一方面,由于[分布式架构](cluster.md)的设计,要求 WAL 本身是高可用的,现在 CeresDB 中,主要有以下几种实现:
2626

2727
- [本地磁盘](wal_on_rocksdb.md)(基于 [RocksDB](http://rocksdb.org/),无分布式高可用)
2828
- [Oceanbase](https://www.oceanbase.com)

docs/src/cn/sdk/python.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def async_write(client, ctx, req):
9191
return await client.write(ctx, req)
9292

9393
point_builder = PointBuilder('demo')
94-
point_builder.set_timestamp(int(round(datetime.datetime.now().timestamp())))
94+
point_builder.set_timestamp(1000 * int(round(datetime.datetime.now().timestamp())))
9595
point_builder.set_tag("name", ValueBuilder().string("test_tag1"))
9696
point_builder.set_field("value", ValueBuilder().double(0.4242))
9797
point = point_builder.build()
@@ -123,15 +123,21 @@ resp = event_loop.run_until_complete(async_query(client, ctx, req))
123123
查询到数据后,逐行逐列处理数据的示例如下:
124124

125125
```python
126-
for row_idx in range(0, resp.row_num()):
126+
# Access row by index in the resp.
127+
for row_idx in range(0, resp.num_rows()):
127128
row_tokens = []
128-
129-
row = resp.get_row(row_idx)
129+
row = resp.row_by_idx(row_idx)
130130
for col_idx in range(0, row.num_cols()):
131131
col = row.column_by_idx(col_idx)
132132
row_tokens.append(f"{col.name()}:{col.value()}#{col.data_type()}")
133+
print(f"row#{row_idx}: {','.join(row_tokens)}")
133134

134-
print(f"row#{col_idx}: {','.join(row_tokens)}")
135+
# Access row by iter in the resp.
136+
for row in resp.iter_rows():
137+
row_tokens = []
138+
for col in row.iter_columns():
139+
row_tokens.append(f"{col.name()}:{col.value()}#{col.data_type()}")
140+
print(f"row: {','.join(row_tokens)}")
135141
```
136142

137143
## 删表

docs/src/en/SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# Technical and Design
5353

5454
- [Architecture](design/architecture.md)
55-
- [Clustering](design/clustering.md)
55+
- [Cluster](design/cluster.md)
5656
- [Storage](design/storage.md)
5757
- [WAL](design/wal.md)
5858
- [WAL on RocksDB](design/wal_on_rocksdb.md)

docs/src/en/design/storage.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ A write request will be written to
2424

2525
Since memtable is not persisted to the underlying storage system in real time, so WAL is required to ensure the reliability of the data in memtable.
2626

27-
On the other hand, due to the design of the [distributed architecture](clustering.md), WAL itself is required to be highly available. Now there are following implementations in CeresDB:
27+
On the other hand, due to the design of the [distributed architecture](cluster.md), WAL itself is required to be highly available. Now there are following implementations in CeresDB:
2828

2929
- [Local disk](wal_on_rocksdb.md) (based on [RocksDB](http://rocksdb.org/), no distributed high availability)
3030
- [OceanBase](https://www.oceanbase.com)

docs/src/en/sdk/python.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async def async_write(client, ctx, req):
9191
return await client.write(ctx, req)
9292

9393
point_builder = PointBuilder('demo')
94-
point_builder.set_timestamp(int(round(datetime.datetime.now().timestamp())))
94+
point_builder.set_timestamp(1000 * int(round(datetime.datetime.now().timestamp())))
9595
point_builder.set_tag("name", ValueBuilder().string("test_tag1"))
9696
point_builder.set_field("value", ValueBuilder().double(0.4242))
9797
point = point_builder.build()
@@ -123,15 +123,21 @@ Currently, the first parameter is necessary for performance on routing.
123123
With retrieved data, we can process it row by row and column by column:
124124

125125
```python
126-
for row_idx in range(0, resp.row_num()):
126+
# Access row by index in the resp.
127+
for row_idx in range(0, resp.num_rows()):
127128
row_tokens = []
128-
129-
row = resp.get_row(row_idx)
129+
row = resp.row_by_idx(row_idx)
130130
for col_idx in range(0, row.num_cols()):
131131
col = row.column_by_idx(col_idx)
132132
row_tokens.append(f"{col.name()}:{col.value()}#{col.data_type()}")
133+
print(f"row#{row_idx}: {','.join(row_tokens)}")
133134

134-
print(f"row#{col_idx}: {','.join(row_tokens)}")
135+
# Access row by iter in the resp.
136+
for row in resp.iter_rows():
137+
row_tokens = []
138+
for col in row.iter_columns():
139+
row_tokens.append(f"{col.name()}:{col.value()}#{col.data_type()}")
140+
print(f"row: {','.join(row_tokens)}")
135141
```
136142

137143
## Drop Table

0 commit comments

Comments
 (0)