sqlalchemy_utils.types.uuid.UUIDType - python examples

Here are the examples of the python api sqlalchemy_utils.types.uuid.UUIDType taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

32 Examples 7

5 View Complete Implementation : 6d1b2c60f58b_add_milestone_model.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('milestone',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('date', sa.Date(), nullable=True),
    sa.Column('name', sa.String(length=40), nullable=False),
    sa.Column('project_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True),
    sa.Column('task_type_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['task_type_id'], ['task_type.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_milestone_project_id'), 'milestone', ['project_id'], unique=False)
    op.create_index(op.f('ix_milestone_task_type_id'), 'milestone', ['task_type_id'], unique=False)

5 View Complete Implementation : 9bd17364fc18_.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('search_filter',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('list_type', sa.String(length=80), nullable=False),
    sa.Column('name', sa.String(length=200), nullable=False),
    sa.Column('search_query', sa.String(length=200), nullable=False),
    sa.Column('person_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), nullable=True),
    sa.Column('project_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), nullable=True),
    sa.ForeignKeyConstraint(['person_id'], ['person.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_search_filter_list_type'), 'search_filter', ['list_type'], unique=False)

5 View Complete Implementation : e29638428dfd_add_schedule_item_table.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('schedule_item',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('start_date', sa.Date(), nullable=True),
    sa.Column('end_date', sa.Date(), nullable=True),
    sa.Column('project_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True),
    sa.Column('task_type_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True),
    sa.Column('ensaty_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True),
    sa.ForeignKeyConstraint(['ensaty_id'], ['task_type.id'], ),
    sa.ForeignKeyConstraint(['project_id'], ['project.id'], ),
    sa.ForeignKeyConstraint(['task_type_id'], ['task_type.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_schedule_item_ensaty_id'), 'schedule_item', ['ensaty_id'], unique=False)
    op.create_index(op.f('ix_schedule_item_project_id'), 'schedule_item', ['project_id'], unique=False)
    op.create_index(op.f('ix_schedule_item_task_type_id'), 'schedule_item', ['task_type_id'], unique=False)

3 View Complete Implementation : column.py
Copyright Mozilla Public License 2.0
Author : AnyBlok
    def __init__(self, *args, **kwargs):
        uuid_kwargs = {}
        self.binary = None
        self.native = None
        for kwarg in ('binary', 'native'):
            if kwarg in kwargs:
                uuid_kwargs[kwarg] = kwargs.pop(kwarg)
                setattr(self, kwarg, uuid_kwargs[kwarg])

        self.sqlalchemy_type = UUIDType(**uuid_kwargs)
        super(UUID, self).__init__(*args, **kwargs)

3 View Complete Implementation : env.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def render_item(type_, obj, autogen_context):
    """Apply custom rendering for selected items."""

    import sqlalchemy_utils
    if type_ == 'type' and \
       isinstance(obj, sqlalchemy_utils.types.uuid.UUIDType):
        autogen_context.imports.add("import sqlalchemy_utils")
        autogen_context.imports.add("import uuid")
        return "sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4"

    return False

3 View Complete Implementation : 0ef6416a507b_.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('astet_instance', sa.Column('target_astet_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True))
    op.create_index(op.f('ix_astet_instance_target_astet_id'), 'astet_instance', ['target_astet_id'], unique=False)
    op.drop_constraint('astet_instance_uc', 'astet_instance', type_='unique')
    op.create_unique_constraint('astet_instance_uc', 'astet_instance', ['astet_id', 'target_astet_id', 'scene_id', 'number'])
    op.drop_constraint('astet_instance_name_uc', 'astet_instance', type_='unique')
    op.create_foreign_key(None, 'astet_instance', 'ensaty', ['target_astet_id'], ['id'])

3 View Complete Implementation : 10cf267d95c9_fix_schedule_item.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('schedule_item', sa.Column('object_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=True))
    op.create_index(op.f('ix_schedule_item_object_id'), 'schedule_item', ['object_id'], unique=False)
    op.drop_index('ix_schedule_item_ensaty_id', table_name='schedule_item')
    op.drop_constraint('schedule_item_ensaty_id_fkey', 'schedule_item', type_='foreignkey')
    op.drop_column('schedule_item', 'ensaty_id')

3 View Complete Implementation : 54ee0d1d60ba_add_build_job_model.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('build_job',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('status', sqlalchemy_utils.types.choice.ChoiceType(STATUSES), nullable=True),
    sa.Column('job_type', sqlalchemy_utils.types.choice.ChoiceType(TYPES), nullable=True),
    sa.Column('ended_at', sa.DateTime(), nullable=True),
    sa.Column('playlist_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.ForeignKeyConstraint(['playlist_id'], ['playlist.id'], ),
    sa.PrimaryKeyConstraint('id')
    )

3 View Complete Implementation : 556526e47daa_.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('login_log',
    sa.Column('id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.Column('updated_at', sa.DateTime(), nullable=True),
    sa.Column('person_id', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.Column('ip_address', sqlalchemy_utils.types.ip_address.IPAddressType(length=50), nullable=True),
    sa.Column('origin', sqlalchemy_utils.types.choice.ChoiceType(ORIGINS), nullable=True),
    sa.ForeignKeyConstraint(['person_id'], ['person.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_login_log_person_id'), 'login_log', ['person_id'], unique=False)
    op.create_index(op.f('ix_login_log_created_at'), 'login_log', ['created_at'], unique=False)

3 View Complete Implementation : 772a5e43f05b_.py
Copyright GNU Affero General Public License v3.0
Author : cgwire
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comment_mentions',
    sa.Column('comment', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.Column('person', sqlalchemy_utils.types.uuid.UUIDType(binary=False), default=uuid.uuid4, nullable=False),
    sa.ForeignKeyConstraint(['comment'], ['comment.id'], ),
    sa.ForeignKeyConstraint(['person'], ['person.id'], ),
    sa.PrimaryKeyConstraint('comment', 'person')
    )
    op.add_column('notification', sa.Column('type', sqlalchemy_utils.types.choice.ChoiceType(TYPES), nullable=True))