Custom metaclass to create hybrid properties in SQLAlchemy
问题 I want to create a custom interface on top of SQLAlchemy so that some pre-defined hybrid properties are supported transparently. Specifically, I want to create a class SpecialColumn and a metaclass so that when a user adds SpecialColumn as an attribute of a class, my custom metaclass replaces that attribute with two SQLAlchemy Column s and adds a hybrid property that gets and sets those two columns as a tuple. Here's my approach so far: First, I defined my special column type: class