Skip to content

Commit

Permalink
docs: adjust readme (#571)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Jan 14, 2025
1 parent 2c168bb commit d7c6f93
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 82 deletions.
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@ Databend Native Client in Rust

## Components

- [**core**](core): Databend RestAPI Rust client
- [**core**](core): Databend RestAPI Rust Client [![image](https://img.shields.io/crates/v/databend-client.svg)](https://crates.io/crates/databend-client)

- [**driver**](driver): Databend SQL client for both RestAPI and FlightSQL
- [**driver**](driver): Databend SQL Client for both RestAPI and FlightSQL in Rust [![image](https://img.shields.io/crates/v/databend-driver.svg)](https://crates.io/crates/databend-driver)

- [**cli**](cli): Databend native CLI
- [**cli**](cli): Databend Native CLI [![image](https://img.shields.io/crates/v/bendsql.svg)](https://crates.io/crates/bendsql)

### Bindings

- [**python**](bindings/python): Databend Python Client [![image](https://img.shields.io/pypi/v/databend-driver.svg)](https://pypi.org/project/databend-driver)

- [**nodejs**](bindings/nodejs): Databend Node.js Client [![image](https://img.shields.io/npm/v/databend-driver.svg)](https://www.npmjs.com/package/databend-driver)

- [**java**](bindings/java): Databend Java Client (upcoming)

## Installation for BendSQL

Expand Down Expand Up @@ -197,9 +205,9 @@ Examples:

- `databend+flight://root:@localhost:8900/database1?connect_timeout=10`

Available Args:
### Available Args

Common:
#### Common

| Arg | Description |
| ----------------- | ------------------------------------ |
Expand All @@ -209,7 +217,7 @@ Common:
| `tls_ca_file` | Custom root CA certificate path. |
| `connect_timeout` | Connect timeout in seconds |

RestAPI client:
#### RestAPI Client

| Arg | Description |
| --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
Expand All @@ -219,7 +227,7 @@ RestAPI client:
| `page_request_timeout_secs` | Timeout for a single page request, default to `30` |
| `presign` | Whether to enable presign for data loading, available arguments are `auto`/`detect`/`on`/`off`. Default to `auto` which only enable presign for `Databend Cloud` |

FlightSQL client:
#### FlightSQL Client

| Arg | Description |
| --------------------------- | ------------------------------------------------------------------------- |
Expand All @@ -230,7 +238,7 @@ FlightSQL client:
| `keep_alive_timeout` | Keep alive timeout in seconds, default to `20` |
| `keep_alive_while_idle` | Default to `true` |

Query Settings:
#### Query Settings

see: [Databend Query Settings](https://databend.rs/doc/sql-commands/show/show-settings)

Expand Down
8 changes: 0 additions & 8 deletions bindings/nodejs/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
# databend-driver

## Build

```shell
cd bindings/nodejs
pnpm install
pnpm run build
```

## Usage

```javascript
Expand Down
15 changes: 4 additions & 11 deletions bindings/python/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# databend-driver

## Build

```shell
cd bindings/python
maturin develop
```

## Usage

### PEP 249 cursor object
### PEP 249 Cursor Object

```python
from databend_driver import BlockingDatabendClient
Expand Down Expand Up @@ -37,7 +30,7 @@ for row in rows:
print(row.values())
```

### Blocking
### Blocking Connection Object

```python
from databend_driver import BlockingDatabendClient
Expand All @@ -62,7 +55,7 @@ for row in rows:
print(row.values())
```

### Asyncio
### Asyncio Connection Object

```python
import asyncio
Expand Down Expand Up @@ -98,7 +91,7 @@ asyncio.run(main())
### General Data Types

| Databend | Python |
|-------------|----------------------|
| ----------- | -------------------- |
| `BOOLEAN` | `bool` |
| `TINYINT` | `int` |
| `SMALLINT` | `int` |
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/tests/asyncio/steps/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ async def _(context):

# Array
row = await context.conn.query_row("select [10::Decimal(15,2), 1.1+2.3]")
assert row.values() == (
[Decimal("10.00"), Decimal("3.40")],
), f"Array: {row.values()}"
assert row.values() == ([Decimal("10.00"), Decimal("3.40")],), (
f"Array: {row.values()}"
)

# Map
row = await context.conn.query_row("select {'xx':to_date('2020-01-01')}")
Expand All @@ -91,9 +91,9 @@ async def _(context):
row = await context.conn.query_row(
"select (10, '20', to_datetime('2024-04-16 12:34:56.789'))"
)
assert row.values() == (
(10, "20", datetime(2024, 4, 16, 12, 34, 56, 789000)),
), f"Tuple: {row.values()}"
assert row.values() == ((10, "20", datetime(2024, 4, 16, 12, 34, 56, 789000)),), (
f"Tuple: {row.values()}"
)


@then("Select numbers should iterate all rows")
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/tests/blocking/steps/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ async def _(context):

# Array
row = context.conn.query_row("select [10::Decimal(15,2), 1.1+2.3]")
assert row.values() == (
[Decimal("10.00"), Decimal("3.40")],
), f"Array: {row.values()}"
assert row.values() == ([Decimal("10.00"), Decimal("3.40")],), (
f"Array: {row.values()}"
)

# Map
row = context.conn.query_row("select {'xx':to_date('2020-01-01')}")
Expand All @@ -86,9 +86,9 @@ async def _(context):
row = context.conn.query_row(
"select (10, '20', to_datetime('2024-04-16 12:34:56.789'))"
)
assert row.values() == (
(10, "20", datetime(2024, 4, 16, 12, 34, 56, 789000)),
), f"Tuple: {row.values()}"
assert row.values() == ((10, "20", datetime(2024, 4, 16, 12, 34, 56, 789000)),), (
f"Tuple: {row.values()}"
)


@then("Select numbers should iterate all rows")
Expand Down
12 changes: 6 additions & 6 deletions bindings/python/tests/cursor/steps/binding.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ async def _(context):
# Array
context.cursor.execute("select [10::Decimal(15,2), 1.1+2.3]")
row = context.cursor.fetchone()
assert row.values() == (
[Decimal("10.00"), Decimal("3.40")],
), f"Array: {row.values()}"
assert row.values() == ([Decimal("10.00"), Decimal("3.40")],), (
f"Array: {row.values()}"
)

# Map
context.cursor.execute("select {'xx':to_date('2020-01-01')}")
Expand All @@ -90,9 +90,9 @@ async def _(context):
# Tuple
context.cursor.execute("select (10, '20', to_datetime('2024-04-16 12:34:56.789'))")
row = context.cursor.fetchone()
assert row.values() == (
(10, "20", datetime(2024, 4, 16, 12, 34, 56, 789000)),
), f"Tuple: {row.values()}"
assert row.values() == ((10, "20", datetime(2024, 4, 16, 12, 34, 56, 789000)),), (
f"Tuple: {row.values()}"
)


@then("Select numbers should iterate all rows")
Expand Down
Loading

0 comments on commit d7c6f93

Please sign in to comment.