4paradigm / 4paradigm/OpenMLDB

Support get_columns and parse protobuf object for Python SDK

未关闭
#3,180 1 条评论 0 个 reaction 已指派 1 人 已被 @tobegit3hub 认领 在 GitHub 查看
sdk
主要语言
C++
星标
1.7k
派生
331
平均合并
12 天 12 小时
30 天内合并 PR
1

描述

Here is the code to test.

```
import sqlalchemy as db
from sqlalchemy import inspect

zk_cluster = "127.0.0.1:2181"
zk_path = "/openmldb"

engine = db.create_engine(f'openmldb:///db1?zk={zk_cluster}&zkPath={zk_path}')
connection = engine.connect()

insp = inspect(engine)
print(insp.get_table_names())

columns = insp.get_columns('employees')

for column in columns:
print(column)
```

We may add the code in `openmldb_dialect.py`.

```
def get_columns(self, connection, table_name, schema=None, **kw):
"""
columns_info = [
{
'name': 'name',
'type': sqlalchemy.String(),
'nullable': False,
'default': None,
'primary_key': False,
'autoincrement': False,
'comment': 'Unique identifier for the row'
}
]
return columns_info
"""
raise NotImplementedError()
```

贡献指南

打开贡献指南

调研方向

The issue is about implementing get_columns and protobuf parsing in openmldb_dialect.py. Start by examining the existing dialect code to understand the connection and table structure. You'll need to fetch column metadata from OpenMLDB, likely via its API or SQL, and map types to SQLAlchemy types. Check if there are existing tests for the dialect to run your implementation against.

由索引模型根据 Issue 内容生成。

评估

技术栈
python, sqlalchemy
领域
backend, databases
Issue 类型
功能
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
65/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。