Skip to content

MySQL Enum reflection convertion issue #148

Open
@sebastiandev

Description

@sebastiandev

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.

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;
class Foo(Base):

    __table__ = Table('foos', metadata, autoload=True)
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions