Skip to content

Fundamentals

Core database patterns using pycubrid (DB-API 2.0) and SQLAlchemy ORM.

Start here if you're new to CUBRID + Python.

Sections

Section Description Driver
connect/ Basic connection, metadata, cursor usage (redirect to pycubrid/01_connect.py) pycubrid
crud/ Create, Read, Update, Delete operations (redirect to pycubrid/02_crud.py) pycubrid
transactions/ Commit, rollback, isolation levels (redirect to pycubrid/03_transactions.py) pycubrid
parameterized-queries/ Parameterized queries for safety and performance pycubrid
error-handling/ Connection failures, constraint violations, timeouts (05_error_handling.py redirects to pycubrid/05_error_handling.py) pycubrid
lob-handling/ Large Object (BLOB/CLOB) operations (redirect to pycubrid/06_lob.py) pycubrid
orm-basics/ SQLAlchemy engine, Core, ORM, relationships, reflection SQLAlchemy
async/ Async I/O with pycubrid.aio and SQLAlchemy async engine asyncio
alembic/ Programmatic Alembic migrations with CubridImpl Alembic
json/ Native JSON column CRUD pycubrid
isolation-levels/ The 3 MVCC isolation levels CUBRID accepts (READ COMMITTED, REPEATABLE READ, SERIALIZABLE), no-dirty-read demo pycubrid

Where a topic entry is marked "redirect", its script only points at the canonical, golden-verified recipe in pycubrid/ and carries no expected/ golden of its own.

Prerequisites

# Start CUBRID via Docker
docker compose up -d

# Install Python driver
pip install pycubrid

# (Optional) Install SQLAlchemy dialect
pip install sqlalchemy-cubrid

For the async SQLAlchemy recipe, install its own requirements:

pip install -r fundamentals/async/requirements.txt

The sqlalchemy[asyncio]>=2.0 target includes SQLAlchemy's required greenlet runtime. Installing plain sqlalchemy can omit that runtime, so importing sqlalchemy.ext.asyncio fails on a fresh SQLAlchemy 2.1 environment.

Connection Info

Setting Value
Host localhost
Port 33000
Database testdb
User dba
Password (empty)

Learning Path

connect/ → crud/ → transactions/ → parameterized-queries/ → orm-basics/

After fundamentals, continue to: - quickstart/ — 5-minute working API - templates/ — Production-ready starters - performance/ — Optimization patterns - pitfalls/ — Common mistakes to avoid