graphql-python / graphql-python/graphene-sqlalchemy

MySQL Enum reflection convertion issue

Aperta
#148 0 commenti 1 reazione 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
985
Fork
223
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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)

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.