Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 132 additions & 0 deletions .github/workflows/publish-pyobsql-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Publish PyObsql to PyPI

on:
workflow_dispatch:
inputs:
version:
description: 'Package version to publish (e.g., 0.1.0). Leave empty to use version from pyproject.toml'
required: false
type: string
publish_to_test_pypi:
description: 'Publish to Test PyPI instead of PyPI'
required: false
type: boolean
default: false
update_version:
description: 'Update version in pyproject.toml before publishing'
required: false
type: boolean
default: true

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
publish_version: ${{ steps.verify_version.outputs.version }}
publish_to_test_pypi: ${{ inputs.publish_to_test_pypi }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Check current version
working-directory: pyobsql-oceanbase-plugin
id: current_version
run: |
CURRENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
echo "Current version in pyproject.toml: $CURRENT_VERSION"

- name: Update version in pyproject.toml
if: inputs.update_version == true && inputs.version != ''
working-directory: pyobsql-oceanbase-plugin
run: |
# Update version in pyproject.toml
sed -i "s/^version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
echo "✅ Updated version to ${{ inputs.version }}"
cat pyproject.toml | grep "^version"

- name: Verify version
working-directory: pyobsql-oceanbase-plugin
id: verify_version
run: |
if [ "${{ inputs.version }}" != "" ] && [ "${{ inputs.update_version }}" == "true" ]; then
PUBLISH_VERSION="${{ inputs.version }}"
else
PUBLISH_VERSION="${{ steps.current_version.outputs.version }}"
fi
echo "Publishing version: $PUBLISH_VERSION"
echo "version=$PUBLISH_VERSION" >> $GITHUB_OUTPUT

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
working-directory: pyobsql-oceanbase-plugin
run: |
# Remove LICENSE file to prevent hatchling from auto-detecting it
rm -f LICENSE LICENSE.txt
python -m build

- name: Check package
working-directory: pyobsql-oceanbase-plugin
run: |
twine check dist/*

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: pypi-distributions
path: pyobsql-oceanbase-plugin/dist/*

publish:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read

steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: pypi-distributions
path: dist/

- name: Publish to Test PyPI
if: needs.build.outputs.publish_to_test_pypi == 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
run: |
pip install twine
twine upload --repository-url https://test.pypi.org/legacy/ dist/*

- name: Publish to PyPI
if: needs.build.outputs.publish_to_test_pypi != 'true'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
pip install twine
twine upload dist/*

- name: Display published package info
run: |
echo "✅ Package published successfully!"
if [ "${{ needs.build.outputs.publish_to_test_pypi }}" == "true" ]; then
echo "📍 Published to: Test PyPI (https://test.pypi.org/project/pyobsql/)"
else
echo "📍 Published to: PyPI (https://pypi.org/project/pyobsql/)"
fi
echo "📦 Version: ${{ needs.build.outputs.publish_version }}"
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ OceanBase is a high-performance database compatible with both MySQL and Oracle p
| [OceanBase SQLAlchemy Plugin](./oceanbase-sqlalchemy-plugin/README.md) | Python ORM | SQLAlchemy dialect for OceanBase Oracle mode, compatible with SQLAlchemy 1.3+ and 2.0+ |
| [OceanBase Dify Plugin](./dify-plugin-oceanbase/README.md) | AI Applications | Enables secure SQL query execution on OceanBase databases through Dify applications |
| [LangGraph Checkpoint OceanBase Plugin](./langgraph-checkpoint-oceanbase-plugin/README.md) | LangGraph CheckpointSaver | Implementation of LangGraph CheckpointSaver that uses OceanBase MySQL mode |
| [PyObsql OceanBase Plugin](./pyobsql-oceanbase-plugin/README.md) | Python SDK | A Python SDK for OceanBase SQL with JSON Table support and SQLAlchemy dialect extensions |

---

Expand Down Expand Up @@ -88,6 +89,14 @@ OceanBase is a high-performance database compatible with both MySQL and Oracle p

---

### ✅ PyObsql OceanBase Plugin

- **Function**: A Python SDK for OceanBase SQL, providing extended SQLAlchemy dialect support, JSON Table operations, and advanced data types (VECTOR, SPARSE_VECTOR, ARRAY, POINT).
- **Use Case**: Python applications that need to interact with OceanBase databases using SQLAlchemy with OceanBase-specific features.
- **Documentation**: [PyObsql OceanBase Plugin](./pyobsql-oceanbase-plugin/README.md)

---

## 📚 Full Documentation Links

| Plugin Name | Documentation Link |
Expand All @@ -100,6 +109,7 @@ OceanBase is a high-performance database compatible with both MySQL and Oracle p
| OceanBase SQLAlchemy Plugin | [OceanBase SQLAlchemy Plugin](./oceanbase-sqlalchemy-plugin/README.md) |
| OceanBase Dify Plugin | [OceanBase Dify Plugin](./dify-plugin-oceanbase/README.md) |
| LangGraph Checkpoint OceanBase Plugin | [LangGraph Checkpoint OceanBase Plugin](./langgraph-checkpoint-oceanbase-plugin/README.md) |
| PyObsql OceanBase Plugin | [PyObsql OceanBase Plugin](./pyobsql-oceanbase-plugin/README.md) |

---

Expand Down
12 changes: 6 additions & 6 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ OceanBase 是一款兼容 MySQL 和 Oracle 协议的高性能数据库。本仓
| [OceanBase SQLAlchemy 插件](./oceanbase-sqlalchemy-plugin/README.md) | Python ORM | SQLAlchemy 方言,支持 OceanBase Oracle 模式,兼容 SQLAlchemy 1.3+ 和 2.0+ |
| [LangGraph Checkpoint OceanBase 插件](./langgraph-checkpoint-oceanbase-plugin/README.md) | 保存 LangGraph 的 checkpoint | 使用 OceanBase MySQL 模式实现了 LangGraph CheckpointSaver |
| [OceanBase Dify 插件](./dify-plugin-oceanbase/README_CN.md) | AI 应用 | 通过 Dify 应用程序在 OceanBase 数据库上安全执行 SQL 查询 |
| [LangGraph Checkpoint OceanBase 插件](./langgraph-checkpoint-oceanbase-plugin/README_CN.md) | 保存 LangGraph 的 checkpoint | 使用 OceanBase MySQL 模式实现了 LangGraph CheckpointSaver |
| [PyObsql OceanBase 插件](./pyobsql-oceanbase-plugin/README.md) | Python SDK | 支持 JSON Table、SQLAlchemy 方言扩展和高级数据类型的 OceanBase Python SDK |

---

Expand Down Expand Up @@ -91,11 +91,11 @@ OceanBase 是一款兼容 MySQL 和 Oracle 协议的高性能数据库。本仓

---

### ✅ LangGraph Checkpoint OceanBase 插件
### ✅ PyObsql OceanBase 插件

- **功能**:使用 OceanBase MySQL 模式实现了 LangGraph CheckpointSaver
- **适用场景**:使用 OceanBase 作为 LangGraph 的 Checkpointer
- **详细文档**:[LangGraph Checkpoint OceanBase 插件](./langgraph-checkpoint-oceanbase-plugin/README_CN.md)
- **功能**:OceanBase SQL 的 Python SDK,提供扩展的 SQLAlchemy 方言支持、JSON Table 操作和高级数据类型(VECTOR、SPARSE_VECTOR、ARRAY、POINT)
- **适用场景**:需要使用 SQLAlchemy 与 OceanBase 数据库交互并利用 OceanBase 特定功能的 Python 应用程序
- **详细文档**:[PyObsql OceanBase 插件](./pyobsql-oceanbase-plugin/README.md)

---

Expand All @@ -111,7 +111,7 @@ OceanBase 是一款兼容 MySQL 和 Oracle 协议的高性能数据库。本仓
| OceanBase SQLAlchemy 插件 | [OceanBase SQLAlchemy 插件](./oceanbase-sqlalchemy-plugin/README.md) |
| LangGraph Checkpoint OceanBase 插件 | [LangGraph Checkpoint OceanBase 插件](./langgraph-checkpoint-oceanbase-plugin/README.md) |
| OceanBase Dify 插件 | [OceanBase Dify 插件](./dify-plugin-oceanbase/README_CN.md) |
| LangGraph Checkpoint OceanBase 插件 | [LangGraph Checkpoint OceanBase 插件](./langgraph-checkpoint-oceanbase-plugin/README_CN.md) |
| PyObsql OceanBase 插件 | [PyObsql OceanBase 插件](./pyobsql-oceanbase-plugin/README.md) |

---

Expand Down
97 changes: 97 additions & 0 deletions pyobsql-oceanbase-plugin/.github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Publish PyObsql to PyPI

on:
workflow_dispatch:
inputs:
version:
description: 'Package version to publish (e.g., 0.1.0)'
required: true
type: string
publish_to_test_pypi:
description: 'Publish to Test PyPI instead of PyPI'
required: false
type: boolean
default: false

permissions:
contents: read
id-token: write # Required for PyPI publishing with trusted publishing

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Update version in pyproject.toml
if: inputs.version != ''
run: |
cd pyobsql-oceanbase-plugin
# Update version in pyproject.toml
sed -i "s/^version = \".*\"/version = \"${{ inputs.version }}\"/" pyproject.toml
echo "Updated version to ${{ inputs.version }}"
cat pyproject.toml | grep "^version"

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: |
cd pyobsql-oceanbase-plugin
python -m build

- name: Check package
run: |
cd pyobsql-oceanbase-plugin
twine check dist/*

- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: pypi-distributions
path: pyobsql-oceanbase-plugin/dist/*

publish:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write # Required for PyPI trusted publishing
contents: read

steps:
- name: Download distributions
uses: actions/download-artifact@v4
with:
name: pypi-distributions
path: dist/

- name: Publish to Test PyPI
if: inputs.publish_to_test_pypi == true
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: dist/

- name: Publish to PyPI
if: inputs.publish_to_test_pypi == false
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/

- name: Display published package info
run: |
echo "✅ Package published successfully!"
if [ "${{ inputs.publish_to_test_pypi }}" == "true" ]; then
echo "📍 Published to: Test PyPI (https://test.pypi.org/project/pyobsql/)"
else
echo "📍 Published to: PyPI (https://pypi.org/project/pyobsql/)"
fi
echo "📦 Version: ${{ inputs.version }}"
45 changes: 45 additions & 0 deletions pyobsql-oceanbase-plugin/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# Virtual environments
venv/
ENV/
env/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Testing
.pytest_cache/
.coverage
htmlcov/

# Documentation
docs/_build/




21 changes: 21 additions & 0 deletions pyobsql-oceanbase-plugin/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/

Copyright 2024 OceanBase

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.




Loading
Loading