Metadata-Version: 2.4
Name: clickzetta-zettapark-python
Version: 0.1.14
Summary: Clickzetta Zettapark for Python
Keywords: analytics,clickzetta,cloud,database,zettapark
Author: Yunqi Inc
Author-email: Yunqi Inc <support@yunqi.tech>
License-Expression: Apache-2.0
License-File: LICENSE.txt
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Database
Classifier: Topic :: Software Development
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: clickzetta-connector>=1.0.25
Requires-Dist: cloudpickle==3.1.0
Requires-Dist: typing-extensions>=4.1.0,<5.0.0
Requires-Python: >=3.8
Project-URL: Documentation, https://yunqi.tech/documents
Project-URL: Homepage, https://www.yunqi.tech/
Description-Content-Type: text/markdown

# Zettapark

Zettapark is a Python DataFrame library for ClickZetta. It provides a familiar
SQL and DataFrame programming model for querying and transforming data in
ClickZetta.

## Highlights

- DataFrame-style API for ClickZetta workloads
- SQL and DataFrame workflows in the same session
- Local data and pandas DataFrame ingestion
- Python UDF support

## Requirements

- Python `3.8+`
- Access to a ClickZetta environment
- Python UDF features require Python `3.10`

## Installation

Install from PyPI:

```bash
pip install clickzetta-zettapark-python
```

Import the main entry point:

```python
from clickzetta.zettapark import Session
```

## Quick Start

### 1. Create a session

```python
from clickzetta.zettapark import Session

connection_parameters = {
    "username": "<username>",
    "password": "<password>",
    "service": "<service>",
    "instance": "<instance>",
    "workspace": "<workspace>",
    "schema": "<schema>",
    "vcluster": "<vcluster>",
}

session = Session.builder.configs(connection_parameters).create()
```

Use the standard ClickZetta connector parameter names shown above.

### 2. Run SQL

```python
rows = session.sql("select 1 as id, 'hello' as message").collect()
print(rows)
```

`Session.sql()` is lazy. Execution starts when you call an action such as
`collect()`, `show()`, or `to_pandas()`.

### 3. Use the DataFrame API

```python
from clickzetta.zettapark.functions import col

source_df = session.create_dataframe(
    [[1, "alice"], [2, "bob"], [3, "cindy"]],
    schema=["id", "name"],
)

source_df.filter(col("id") >= 2).show()
```

You can mix SQL and DataFrame operations in the same workflow:

```python
from clickzetta.zettapark.functions import avg

sales_df = session.table("sales.orders")
summary_df = sales_df.group_by("region").agg(avg("amount").alias("avg_amount"))
summary_df.sort("region").show()
```

### 4. Create a DataFrame from pandas

```python
import pandas as pd

pdf = pd.DataFrame(
    [(1, "beijing"), (2, "shanghai")],
    columns=["id", "city"],
)

session.create_dataframe(pdf).show()
```

## Resources

- Package: `clickzetta-zettapark-python`
- Homepage: <https://www.yunqi.tech/>
- Documentation: <https://yunqi.tech/documents>
- ClickZetta docs: <https://doc.clickzetta.com/>
- Development and contribution guide: `AGENTS.md`

## License

Apache-2.0. See `LICENSE.txt` for details.
