Python sqlalchemy.dialects.mysql 模块,VARCHAR 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用sqlalchemy.dialects.mysql.VARCHAR

项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('comments',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('body', sa.Text(), nullable=True),
    sa.Column('body_html', sa.Text(), nullable=True),
    sa.Column('timestamp', sa.DateTime(), nullable=True),
    sa.Column('disabled', sa.Boolean(), nullable=True),
    sa.Column('author_id', sa.Integer(), nullable=True),
    sa.Column('post_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['author_id'], ['users.id'], ),
    sa.ForeignKeyConstraint(['post_id'], ['posts.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_comments_timestamp'), 'comments', ['timestamp'], unique=False)
    op.alter_column(u'statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('machine_statistic',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=64), nullable=True),
    sa.Column('timestamp', sa.String(length=64), nullable=True),
    sa.Column('userid', sa.String(length=64), nullable=True),
    sa.Column('netcode', sa.String(length=64), nullable=True),
    sa.Column('login_time', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('id')
    )
    op.create_index(op.f('ix_machine_statistic_login_time'), 'machine_statistic', ['login_time'], unique=False)
    op.alter_column(u'statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:metaseek    作者:ahoarfrost    | 项目源码 | 文件源码
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('nuccore',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('nuccore_uid', mysql.VARCHAR(length=50), nullable=True),
    sa.Column('nuccore_link', mysql.TEXT(), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('dataset_to_nuccore',
    sa.Column('dataset_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('nuccore_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['dataset_id'], [u'dataset.id'], name=u'dataset_to_nuccore_ibfk_1'),
    sa.ForeignKeyConstraint(['nuccore_id'], [u'nuccore.id'], name=u'dataset_to_nuccore_ibfk_2'),
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    # ### end Alembic commands ###
项目:quilt    作者:quiltdata    | 项目源码 | 文件源码
def upgrade():
    op.add_column('instance', sa.Column('created_by', mysql.VARCHAR(collation='utf8_bin', length=64), nullable=False))
    op.add_column('instance', sa.Column('created_at', sa.DateTime(), nullable=False))
    op.add_column('instance', sa.Column('updated_by', mysql.VARCHAR(collation='utf8_bin', length=64), nullable=False))
    op.add_column('instance', sa.Column('updated_at', sa.DateTime(), nullable=False))

    op.execute("""
        UPDATE instance JOIN (
            SELECT instance_id, min(created) min_created, max(created) max_created, author
            FROM log
            GROUP BY instance_id, author
        ) log
        ON id = instance_id
        SET created_at = min_created, created_by = author,
            updated_at = max_created, updated_by = author
    """)
项目:TypingSystem    作者:TrustMe5    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('roles',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('name', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate=u'utf8_unicode_ci',
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.create_table('users',
    sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
    sa.Column('username', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
    sa.Column('role_id', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('email', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=64), nullable=True),
    sa.Column('password_hash', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128), nullable=True),
    sa.Column('confirmed', mysql.TINYINT(display_width=1), autoincrement=False, nullable=True),
    sa.ForeignKeyConstraint(['role_id'], [u'roles.id'], name=u'users_ibfk_1'),
    sa.PrimaryKeyConstraint('id'),
    mysql_collate=u'utf8_unicode_ci',
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.drop_table('context_show')
    ### end Alembic commands ###
项目:raw-data-repository    作者:all-of-us    | 项目源码 | 文件源码
def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(u'site', sa.Column('consortium_name', mysql.VARCHAR(length=255), nullable=False))
    op.drop_constraint(None, 'site', type_='foreignkey')
    op.alter_column(u'site', 'hpo_id',
               existing_type=mysql.INTEGER(display_width=11),
               nullable=False)
    op.drop_column(u'site', 'zip_code')
    op.drop_column(u'site', 'state')
    op.drop_column(u'site', 'site_status')
    op.drop_column(u'site', 'physical_location_name')
    op.drop_column(u'site', 'phone_number')
    op.drop_column(u'site', 'organization_id')
    op.drop_column(u'site', 'notes')
    op.drop_column(u'site', 'longitude')
    op.drop_column(u'site', 'link')
    op.drop_column(u'site', 'launch_date')
    op.drop_column(u'site', 'latitude')
    op.drop_column(u'site', 'directions')
    op.drop_column(u'site', 'city')
    op.drop_column(u'site', 'admin_emails')
    op.drop_column(u'site', 'address_2')
    op.drop_column(u'site', 'address_1')
    op.drop_table('organization')
    # ### end Alembic commands ###
项目:raw-data-repository    作者:all-of-us    | 项目源码 | 文件源码
def upgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('code', sa.Column('short_value', sa.String(length=50), nullable=True))
    op.add_column('code_history', sa.Column('short_value', sa.String(length=50), nullable=True))
    op.alter_column('participant_summary', 'city',
               existing_type=mysql.VARCHAR(length=80),
               type_=sa.String(length=255),
               existing_nullable=True)
    op.alter_column('participant_summary', 'first_name',
               existing_type=mysql.VARCHAR(length=80),
               type_=sa.String(length=255),
               existing_nullable=False)
    op.alter_column('participant_summary', 'last_name',
               existing_type=mysql.VARCHAR(length=80),
               type_=sa.String(length=255),
               existing_nullable=False)
    op.alter_column('participant_summary', 'middle_name',
               existing_type=mysql.VARCHAR(length=80),
               type_=sa.String(length=255),
               existing_nullable=True)
    # ### end Alembic commands ###
项目:raw-data-repository    作者:all-of-us    | 项目源码 | 文件源码
def downgrade_rdr():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('participant_summary', 'middle_name',
               existing_type=sa.String(length=255),
               type_=mysql.VARCHAR(length=80),
               existing_nullable=True)
    op.alter_column('participant_summary', 'last_name',
               existing_type=sa.String(length=255),
               type_=mysql.VARCHAR(length=80),
               existing_nullable=False)
    op.alter_column('participant_summary', 'first_name',
               existing_type=sa.String(length=255),
               type_=mysql.VARCHAR(length=80),
               existing_nullable=False)
    op.alter_column('participant_summary', 'city',
               existing_type=sa.String(length=255),
               type_=mysql.VARCHAR(length=80),
               existing_nullable=True)
    op.drop_column('code_history', 'short_value')
    op.drop_column('code', 'short_value')
    # ### end Alembic commands ###
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:BookCloud    作者:livro-aberto    | 项目源码 | 文件源码
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user', 'email',
               existing_type=mysql.VARCHAR(length=255),
               type_=sa.String(length=75),
               existing_nullable=False)
    # ### end Alembic commands ###
项目:BookCloud    作者:livro-aberto    | 项目源码 | 文件源码
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user', 'email',
               existing_type=sa.String(length=75),
               type_=mysql.VARCHAR(length=255),
               existing_nullable=False)
    # ### end Alembic commands ###
项目:QXSConsolas    作者:qxsch    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:flasky    作者:RoseOu    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:GWMMS    作者:lvhuiyang    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('Products',
    sa.Column('maker', mysql.CHAR(collation=u'utf8_unicode_ci', length=2), nullable=True),
    sa.Column('model', mysql.INTEGER(display_width=11), autoincrement=False, nullable=True),
    sa.Column('tyle', mysql.VARCHAR(collation=u'utf8_unicode_ci', length=10), nullable=True),
    mysql_collate=u'utf8_unicode_ci',
    mysql_default_charset=u'utf8',
    mysql_engine=u'InnoDB'
    )
    op.drop_index(op.f('ix_users_username'), table_name='users')
    op.drop_index(op.f('ix_users_email'), table_name='users')
    op.drop_table('users')
    op.drop_table('roles')
    ### end Alembic commands ###
项目:oa_qian    作者:sunqb    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`~sqlalchemy.types.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=False,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(u'statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=False,
               existing_server_default=sa.text(u"''"))
    op.drop_index(op.f('ix_comments_timestamp'), table_name='comments')
    op.drop_table('comments')
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True)
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=False)
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('machine_statistic', sa.Column('gateway', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('ip', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('localip', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('wlanmac', sa.String(length=64), nullable=True))
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=False,
               existing_server_default=sa.text(u"''"))
    op.drop_column('machine_statistic', 'wlanmac')
    op.drop_column('machine_statistic', 'localip')
    op.drop_column('machine_statistic', 'ip')
    op.drop_column('machine_statistic', 'gateway')
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('posts', sa.Column('body_abtract', sa.Text(), nullable=True))
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column(u'statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=False,
               existing_server_default=sa.text(u"''"))
    op.drop_index(op.f('ix_machine_statistic_login_time'), table_name='machine_statistic')
    op.drop_table('machine_statistic')
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('machine_statistic', sa.Column('version', sa.String(length=64), nullable=True))
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=False,
               existing_server_default=sa.text(u"''"))
    op.drop_column('machine_statistic', 'version')
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('machine_statistic', sa.Column('company', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('openid', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('userpasswd', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('webkey', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('wlanpasswd', sa.String(length=64), nullable=True))
    op.add_column('machine_statistic', sa.Column('wlanssid', sa.String(length=64), nullable=True))
    op.alter_column('statistic_visitor', 'referred',
               existing_type=mysql.VARCHAR(collation=u'utf8_unicode_ci', length=128),
               nullable=True,
               existing_server_default=sa.text(u"''"))
    ### end Alembic commands ###
项目:chihu    作者:yelongyu    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:ShelbySearch    作者:Agentscreech    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:pyetje    作者:rorlika    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`~sqlalchemy.types.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: type_})
项目:Price-Comparator    作者:Thejas-1    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:picmeup    作者:zhonghcc    | 项目源码 | 文件源码
def upgrade():
    op.add_column('users',sa.Column('origin',sa.String(255),nullable=True))
    op.add_column('users',sa.Column('origin_url',sa.Text,nullable=True))
    op.add_column('users',sa.Column('description',sa.Text,nullable=True))
    op.add_column('users',sa.Column('role',sa.String(255),nullable=True))
    op.add_column('users',sa.Column('is_imported',sa.Boolean,nullable=True))
    op.add_column('articles',sa.Column('author_id',sa.Integer,nullable=True))

    op.alter_column('users','password',nullable=True,existing_type=mysql.VARCHAR(255))
    pass
项目:picmeup    作者:zhonghcc    | 项目源码 | 文件源码
def downgrade():
    op.drop_column('users','description')
    op.drop_column('users','origin')
    op.drop_column('users','origin_url')
    op.drop_column('users','role')
    op.drop_column('users','is_imported')
    op.drop_column('articles','author_id')

    op.alter_column('users','password',nullable=True,existing_type=mysql.VARCHAR(255))
    pass
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:Flask-NvRay-Blog    作者:rui7157    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:Callandtext    作者:iaora    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:python_ddd_flask    作者:igorvinnicius    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:mini    作者:JJWSSS    | 项目源码 | 文件源码
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'userName',
               existing_type=mysql.VARCHAR(length=64),
               nullable=True)
    ### end Alembic commands ###
项目:mini    作者:JJWSSS    | 项目源码 | 文件源码
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('users', 'userName',
               existing_type=mysql.VARCHAR(length=64),
               nullable=False)
    ### end Alembic commands ###
项目:webapp    作者:superchilli    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:quilt    作者:quiltdata    | 项目源码 | 文件源码
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('customer', 'stripe_customer_id',
               existing_type=mysql.VARCHAR(charset='utf8', collation='utf8_bin', length=255),
               nullable=True)
    # ### end Alembic commands ###
项目:quilt    作者:quiltdata    | 项目源码 | 文件源码
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('customer', 'stripe_customer_id',
               existing_type=mysql.VARCHAR(charset='utf8', collation='utf8_bin', length=255),
               nullable=False)
    # ### end Alembic commands ###
项目:quilt    作者:quiltdata    | 项目源码 | 文件源码
def upgrade():
    op.create_table('customer',
    sa.Column('id', mysql.VARCHAR(collation='utf8_bin', length=64), nullable=False),
    sa.Column('stripe_customer_id', mysql.VARCHAR(collation='utf8_bin', length=255), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
项目:quilt    作者:quiltdata    | 项目源码 | 文件源码
def CaseSensitiveString(length):
    return mysql.VARCHAR(length, collation=UTF8_BIN)
项目:QualquerMerdaAPI    作者:tiagovizoto    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:gardenbot    作者:GoestaO    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:flask-zhenai-mongo-echarts    作者:Fretice    | 项目源码 | 文件源码
def with_variant(self, type_, dialect_name):
        """Produce a new type object that will utilize the given
        type when applied to the dialect of the given name.

        e.g.::

            from sqlalchemy.types import String
            from sqlalchemy.dialects import mysql

            s = String()

            s = s.with_variant(mysql.VARCHAR(collation='foo'), 'mysql')

        The construction of :meth:`.TypeEngine.with_variant` is always
        from the "fallback" type to that which is dialect specific.
        The returned type is an instance of :class:`.Variant`, which
        itself provides a :meth:`.Variant.with_variant`
        that can be called repeatedly.

        :param type_: a :class:`.TypeEngine` that will be selected
         as a variant from the originating type, when a dialect
         of the given name is in use.
        :param dialect_name: base name of the dialect which uses
         this type. (i.e. ``'postgresql'``, ``'mysql'``, etc.)

        .. versionadded:: 0.7.2

        """
        return Variant(self, {dialect_name: to_instance(type_)})
项目:apizen    作者:blackmatrix7    | 项目源码 | 文件源码
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('password', mysql.VARCHAR(length=50), nullable=True))
    op.drop_column('user', 'password_hash')
    # ### end Alembic commands ###
项目:apizen    作者:blackmatrix7    | 项目源码 | 文件源码
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('user', sa.Column('last_login', sa.DateTime(), nullable=True))
    op.alter_column('user', 'email',
               existing_type=mysql.VARCHAR(length=100),
               nullable=False)
    # ### end Alembic commands ###