def __new__(cls, name, bases, attrs):
            # add Database.Base as parent class
            bases = list(bases)
            if object in bases:
                bases.remove(object)
            bases.append(Database.Base)
            seen = set()
            bases = tuple(base for base in bases if not base in seen and not seen.add(base))

            attrs['__tablename__'] = StringUtil.camelcase_to_underscore(name)
            attrs['id'] = Column(Integer, primary_key = True)
            attrs['created_at'] = Column(DateTime)
            attrs['updated_at'] = Column(DateTime)
            attrs['_readable_name'] = attrs['__tablename__']
            attrs['_readable_names'] =  attrs['_readable_name'] + 's'
            attrs['_one_to_models'] = attrs['_many_to_models'] = []
            if not '__mapper_args__' in attrs:
                attrs['__mapper_args__'] = {}

            # the for loop bellow handles table inheritance
            for base in [base for base in bases if base in models]:
                if not hasattr(base, 'real_type'):
                    base.real_type = Column('real_type', String(24), nullable = False, index = True)
                    base.__mapper_args__['polymorphic_on'] = base.real_type
                    base.__mapper_args__['polymorphic_identity'] = base._readable_name
                attrs['id'] = Column(Integer, ForeignKey('{0}.id'.format(base._readable_name), ondelete = "CASCADE"), primary_key = True)
                attrs['__mapper_args__']['polymorphic_identity'] = attrs['_readable_name']
                attrs['__mapper_args__']['inherit_condition'] = attrs['id'] == base.id

            return MyDeclarativeMeta.__new__(cls, name, bases, attrs)
dataset/ETHPy150Open tylerlong/quick_orm/quick_orm/core.py/Database.DefaultMeta.__new__/original