Skip to main content

Python client SDK for the MatrixOrigin MOI Platform

Project description

MOI Python SDK

Python client for the MatrixOrigin MOI Catalog Service, mirroring the feature set provided by the Go SDK (moi-go-sdk). It offers both a low-level RawClient (1:1 HTTP bindings) and a high-level SDKClient with productivity helpers for role/table workflows.

Installation

方式一:从 PyPI 安装(推荐)

如果包已发布到 PyPI,可以直接安装:

pip install moi-python-sdk

方式二:从 GitHub 直接安装

无需下载源码,直接从 GitHub 仓库安装:

pip install git+https://github.com/matrixorigin/moi-python-sdk.git

或者安装特定版本/分支:

# 安装特定分支
pip install git+https://github.com/matrixorigin/moi-python-sdk.git@main

# 安装特定标签版本
pip install git+https://github.com/matrixorigin/moi-python-sdk.git@v0.1.0

方式三:本地开发安装

如果需要修改源码或进行开发:

# 克隆仓库
git clone https://github.com/matrixorigin/moi-python-sdk.git
cd moi-python-sdk

# 安装依赖和包
pip install -r requirements.txt
pip install -e .  # 可编辑模式安装,修改代码后无需重新安装

Quick Start

from moi import RawClient, SDKClient, TablePrivInfo

raw = RawClient(
    base_url="https://api.example.com",
    api_key="your-api-key",
)

# Low-level call
catalog = raw.create_catalog({"name": "analytics", "description": "Prod catalog"})

# High-level helpers
sdk = SDKClient(raw)
role_id, created = sdk.create_table_role(
    role_name="analytics_reader",
    comment="Read-only access",
    table_privs=[
        TablePrivInfo(
            table_id=123,
            priv_codes=["DT8"],  # SELECT
        ),
    ],
)

Features

  • Full coverage of Catalog/Database/Table/Volume/File/Folder APIs
  • Detailed per-method references in docs/api_reference.md (EN) and docs/api_reference_zh.md (中文)
  • Connector workflows: local uploads, connector imports, preview
  • User/Role/Privilege management
  • GenAI, NL2SQL, Health, and Log endpoints
  • Streaming downloads via FileStream
  • High-level helpers for table role management and file-to-table import

Development

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

Code style follows standard pyproject-less tooling (feel free to add linters or tests). Contributions are welcome—please align new APIs with the Go SDK behavior to keep parity between implementations.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moi_python_sdk-0.1.1.dev0.tar.gz (58.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moi_python_sdk-0.1.1.dev0-py3-none-any.whl (39.0 kB view details)

Uploaded Python 3

File details

Details for the file moi_python_sdk-0.1.1.dev0.tar.gz.

File metadata

  • Download URL: moi_python_sdk-0.1.1.dev0.tar.gz
  • Upload date:
  • Size: 58.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for moi_python_sdk-0.1.1.dev0.tar.gz
Algorithm Hash digest
SHA256 a4b9c4ce5e0ddb92189ffc42244b5f342463bb06b9bcfdf01877bbcd9ef461d4
MD5 762419223e255a90b42c93e9a95e6863
BLAKE2b-256 fa36aa137fc6ad26d3a4c7731d1104e3fd8a61449d3b2e84228620d77c04fba0

See more details on using hashes here.

File details

Details for the file moi_python_sdk-0.1.1.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for moi_python_sdk-0.1.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 953b64ee91978c4d1b7c29449265f6309f5bcb1c174d8fc3ce7c620d409353ad
MD5 c032e12a33d04faa573321e0d30eca4f
BLAKE2b-256 e863fdec7a3a869f029221b3530a0e8fea49c9602ba8bb01c01ba9b282f786a1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page