graphql-python / graphql-python/graphene-sqlalchemy
MySQL Enum reflection convertion issue
- 主要語言
- Python
- 星號
- 985
- 分支
- 223
- PR 合併指標
- 30 天內沒有已合併 PR
描述
When using reflection to build the models (instead of declarative) the Enum conversion fails because the ENUM column is treated as string so doing ```type.name``` returns None.
```sql
CREATE TABLE `foos` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`status` ENUM('open', 'closed') DEFAULT 'open',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
```
```python
class Foo(Base):
__table__ = Table('foos', metadata, autoload=True)
```
```shell
enum_class = super(EnumMeta, metacls).__new__(metacls, cls, bases, classdict) TypeError: Error when calling the metaclass bases type() argument 1 must be string, not None
```
Suggested [fix](https://github.com/graphql-python/graphene-sqlalchemy/pull/147)
貢獻指南
研究方向
從反射的 Table('foos', metadata, autoload=True) 路徑以及讀取 type.name 的 Enum 轉換開始。使用所示的 MySQL ENUM schema 重現該故障,然後檢查 PR #147 中建議的修正,並驗證反射不再引發 metaclass TypeError。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- mysql, python, sqlalchemy
- 領域
- databases
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100