Metadata-Version: 2.1
Name: databend
Version: 1.2.344
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: pdoc ; extra == 'docs'
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: pandas ; extra == 'test'
Requires-Dist: polars ; extra == 'test'
Provides-Extra: benchmark
Provides-Extra: docs
Provides-Extra: test
Summary: Databend Python Binding
Author: Databend Authors <opensource@datafuselabs.com>
Author-email: Databend Authors <opensource@datafuselabs.com>
License: Apache-2.0
Requires-Python: >=3.7
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://databend.rs
Project-URL: Homepage, https://databend.rs
Project-URL: Home-page, https://databend.rs
Project-URL: Repository, https://github.com/datafuselabs/databend

# Databend Python Binding

This crate intends to build a native python binding.

## Installation

```bash
pip install databend
```

## Usage

### Basic:

```python
from databend import SessionContext

ctx = SessionContext()

df = ctx.sql("select number, number + 1, number::String as number_p_1 from numbers(8)")

# convert to pyarrow
df.to_py_arrow()

# convert to pandas
df.to_pandas()

```

### Register external table:

***supported functions:***
- register_parquet
- register_ndjson
- register_csv
- register_tsv

```python

ctx.register_parquet("pa", "/home/sundy/dataset/hits_p/", pattern = ".*.parquet")
ctx.sql("select * from pa limit 10").collect()
```


### Tenant separation:

```python
ctx = SessionContext(tenant = "a")
```


## Development

Setup virtualenv:

```shell
python -m venv .venv
```

Activate venv:

```shell
source .venv/bin/activate
````

Install `maturin`:

```shell
pip install "maturin[patchelf]"
```

Build bindings:

```shell
maturin develop
```

Run tests:

```shell
maturin develop -E test
```

Build API docs:

```shell
maturin develop -E docs
pdoc databend
```

## Storage configuration

- Meta Storage directory(Catalogs, Databases, Tables, Partitions, etc.): `./.databend/_meta`
- Data Storage directory: `./.databend/_data`
- Cache Storage directory: `./.databend/_cache`
- Logs directory: `./.databend/logs`

## More

Databend python api is inspired by [arrow-datafusion-python](https://github.com/apache/arrow-datafusion-python), thanks for their great work.
