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.
We recommend you to install it with command:
pip install myscaledb-client
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()
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])
To check out the API docs, visit the readthedocs site.