Metadata-Version: 2.1
Name: myscaledb-client
Version: 2.0.6
Summary: Async and sync http MyScale client for python 3.6+
Home-page: https://github.com/myscale/myscaledb-client
Author: MochiXu
Author-email: mochix@moqi.ai
License: MIT
Keywords: clickhouse async sync python aiohttp
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Description-Content-Type: text/markdown
Provides-Extra: aiohttp
Provides-Extra: aiohttp-speedups
Provides-Extra: httpx
Provides-Extra: httpx-speedups
License-File: LICENSE

# MyScale Database Client

[![PyPI version](https://badge.fury.io/py/myscaledb-client.svg)](https://badge.fury.io/py/myscaledb-client)
[![Documentation Status](https://readthedocs.org/projects/myscaledb-client/badge/?version=latest)](https://myscaledb-client.readthedocs.io/en/latest/?badge=latest)

`myscaledb-client` is an async/sync http(s) MyScale client for python 3.6+ supporting
type conversion in both directions, streaming, lazy decoding on select queries,
and a fully typed interface.

## Table of Contents

- [MyScale Database Client](#myscale-database-client)
  - [Table of Contents](#table-of-contents)
  - [Installation](#installation)
  - [Quick Start](#quick-start)
    - [Connecting to MyScale](#connecting-to-myscale)
    - [Querying the database](#querying-the-database)
  - [Documentation](#documentation)

## Installation

We recommend you to install it with command:

```bash
pip install myscaledb-client
```

## Quick Start

### Connecting to MyScale

The quickest way to get up and running with `myscaledb-client` is to simply connect
and check MyScale is alive.

```python
# This is a demo using Client.
# Client works in sync mode and is simple to use.

from myscaledb import Client

def main():
    client = Client(url='http://localhost:8123')
    alive = client.is_alive()
    print(f"Is MyScale alive? -> {alive}")

if __name__ == '__main__':
    main()
```

### Querying the database

Create a table with 4 dimensional vectors:

```python
client.execute(
    """CREATE TABLE default.test
    (
        id UInt64,
        name String,
        vector FixedArray(Float32, 4)
    )
    ENGINE = MergeTree ORDER BY id"""
)
```

View all tables in current database:

```python
res = client.fetch(query="show tables")
print([row[0] for row in res])
```

## Documentation

To check out the [API docs](https://myscaledb-client.readthedocs.io/en/latest/introduction.html), visit the [readthedocs site](https://myscaledb-client.readthedocs.io/en/latest/introduction.html).
