Skip to content

Lightweight async/sync http(s) MyScale/ClickHouse client for python 3.6+ with types converting

License

Notifications You must be signed in to change notification settings

myscale/myscaledb-client

 
 

Repository files navigation

MyScale Database Client

PyPI version Documentation Status

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

Installation

We recommend you to install it with command:

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.

# 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:

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:

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

Documentation

To check out the API docs, visit the readthedocs site.

About

Lightweight async/sync http(s) MyScale/ClickHouse client for python 3.6+ with types converting

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 83.7%
  • Cython 15.3%
  • Other 1.0%