Here are the examples of the python api sqlalchemy_utils.types.UUIDType taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
3
Example 1
@declared_attr
def id(cls):
"""
Database identity for this model, used for foreign key references from other models
"""
if cls.__uuid_primary_key__:
return Column(UUIDType(binary=False), default=uuid1mc, primary_key=True)
else:
return Column(Integer, primary_key=True)
0
Example 2
def upgrade():
op.add_column('event_session', sa.Column('uuid', sqlalchemy_utils.types.UUIDType(binary=False), nullable=True))
op.create_unique_constraint('event_session_uuid_key', 'event_session', ['uuid'])