Skip to main content

OceanBase sqlalchemy dialect

Project description

OceanBase Python Client

A OceanBase client for the Python programming language.

OceanBase is an enterprise distributed relational database with high availability, high performance, horizontal scalability, and compatibility with SQL standards.

Installation

pip install oceanbase_py

SQLAlchemy Usage

To connect to OceanBase using SQLAlchemy, use a connection string (URL) following this pattern:

  • User: User Name
  • Password: Password
  • Host: host
  • Port: port
  • Database: Database Name

Here's what the connection string looks like:

oceanbase://<User>:<Password>@<Host>:<Port>/<Database>
oceanbase_py://<User>:<Password>@<Host>:<Port>/<Database>
oceanbase://<User>:<Password>@<Host>:<Port>/<Owner>
oceanbase_py://<User>:<Password>@<Host>:<Port>/<Owner>

Example

It is recommended to use python 3.x to connect to the OceanBase database, eg:

from sqlalchemy import create_engine
from sqlalchemy.schema import Table, MetaData
from sqlalchemy.sql.expression import select, text

engine = create_engine('oceanbase://root:xxx@localhost:8081/db')
connection = engine.connect()

rows = connection.execute(text("SELECT * FROM test")).fetchall()

Limits

  • Oracle tenants are not currently supported.

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

oceanbase_py-0.0.1.2.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

oceanbase_py-0.0.1.2-py3-none-any.whl (11.7 kB view hashes)

Uploaded Python 3

Supported by

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