当前位置: 首页>>代码示例>>Python>>正文


Python mysql.TEXT属性代码示例

本文整理汇总了Python中sqlalchemy.dialects.mysql.TEXT属性的典型用法代码示例。如果您正苦于以下问题:Python mysql.TEXT属性的具体用法?Python mysql.TEXT怎么用?Python mysql.TEXT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sqlalchemy.dialects.mysql的用法示例。


在下文中一共展示了mysql.TEXT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_column_datatype_to_string

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def test_column_datatype_to_string(self):
        test_cases = (
            (DATE(), "DATE"),
            (VARCHAR(length=255), "VARCHAR(255)"),
            (
                VARCHAR(length=255, charset="latin1", collation="utf8mb4_general_ci"),
                "VARCHAR(255)",
            ),
            (NVARCHAR(length=128), "NATIONAL VARCHAR(128)"),
            (TEXT(), "TEXT"),
        )

        for original, expected in test_cases:
            actual = MySQLEngineSpec.column_datatype_to_string(
                original, mysql.dialect()
            )
            self.assertEqual(actual, expected) 
开发者ID:apache,项目名称:incubator-superset,代码行数:19,代码来源:mysql_tests.py

示例2: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('templates',
        sa.Column('template_name', sa.String(length=50), nullable=False),
        sa.Column('template', mysql.TEXT(), nullable=False),
        sa.Column('is_modified', mysql.TINYINT(), nullable=False),
        sa.PrimaryKeyConstraint('template_name')
    )
    # ### end Alembic commands ### 
开发者ID:RiotGames,项目名称:cloud-inquisitor,代码行数:11,代码来源:a2e49567641a_add_templates_table.py

示例3: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():   # noqa: D103
    if context.config.get_main_option('sqlalchemy.url').startswith('mysql'):
        op.alter_column(table_name='variable', column_name='val', type_=mysql.TEXT) 
开发者ID:apache,项目名称:airflow,代码行数:5,代码来源:d2ae31099d61_increase_text_size_for_mysql.py

示例4: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def upgrade():
    for prefix in TABLE_PREFIXES:
        op.alter_column(prefix + '_comments', 'text',
                   existing_type=mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_bin', length=255),
                   type_=mysql.TEXT(collation='utf8mb4_bin'),
                   existing_nullable=False) 
开发者ID:nyaadevs,项目名称:nyaa,代码行数:8,代码来源:b79d2fcafd88_comment_text.py

示例5: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():
    for prefix in TABLE_PREFIXES:
        op.alter_column(prefix + '_comments', 'text',
                   existing_type=mysql.TEXT(collation='utf8mb4_bin'),
                   type_=mysql.VARCHAR(charset='utf8mb4', collation='utf8mb4_bin', length=255),
                   existing_nullable=False) 
开发者ID:nyaadevs,项目名称:nyaa,代码行数:8,代码来源:b79d2fcafd88_comment_text.py

示例6: test_ndb_string_to_text

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def test_ndb_string_to_text(self):
        test_engine = self.test_engine
        self.assertEqual("TEXT",
                         str(String(4096, mysql_ndb_type=TEXT).compile(
                             dialect=test_engine.dialect))) 
开发者ID:openstack,项目名称:oslo.db,代码行数:7,代码来源:test_ndb.py

示例7: test_non_ndb_autostringtext

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def test_non_ndb_autostringtext(self):
        test_engine = self.test_engine
        self.assertEqual("VARCHAR(4096)",
                         str(String(4096, mysql_ndb_type=TEXT).compile(
                             dialect=test_engine.dialect))) 
开发者ID:openstack,项目名称:oslo.db,代码行数:7,代码来源:test_ndb.py

示例8: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('job', 'log',
               existing_type=mysql.TEXT,
               type_=mysql.MEDIUMTEXT,
               existing_nullable=True)
    ### end Alembic commands ### 
开发者ID:okpy,项目名称:ok,代码行数:9,代码来源:131bc6d9d550_job_logs_should_use_mediumtext.py

示例9: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('job', 'failed',
               existing_type=mysql.MEDIUMTEXT,
               type_=mysql.TEXT,
               existing_nullable=False)
    ### end Alembic commands ### 
开发者ID:okpy,项目名称:ok,代码行数:9,代码来源:131bc6d9d550_job_logs_should_use_mediumtext.py

示例10: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def upgrade():
    from inbox.ignition import main_engine
    engine = main_engine(pool_size=1, max_overflow=0)
    from inbox.models.session import session_scope
    from sqlalchemy.ext.declarative import declarative_base
    Base = declarative_base()
    Base.metadata.reflect(engine)

    class Message(Base):
        __table__ = Base.metadata.tables['message']

    with session_scope(versioned=False) \
            as db_session:
        null_field_count = db_session.query(func.count(Message.id)). \
            filter(or_(Message.from_addr.is_(None),
                       Message.to_addr.is_(None),
                       Message.cc_addr.is_(None),
                       Message.bcc_addr.is_(None))).scalar()
        print 'messages to migrate:', null_field_count
        if int(null_field_count):
            for message in db_session.query(Message):
                for attr in ('to_addr', 'from_addr', 'cc_addr', 'bcc_addr'):
                    if getattr(message, attr) is None:
                        setattr(message, attr, [])
                print '.',
        db_session.commit()

    print 'making addrs non-nullable'

    op.alter_column('message', 'bcc_addr', existing_type=mysql.TEXT(),
                    nullable=False)
    op.alter_column('message', 'cc_addr', existing_type=mysql.TEXT(),
                    nullable=False)
    op.alter_column('message', 'from_addr', existing_type=mysql.TEXT(),
                    nullable=False)
    op.alter_column('message', 'to_addr', existing_type=mysql.TEXT(),
                    nullable=False) 
开发者ID:nylas,项目名称:sync-engine,代码行数:39,代码来源:064_make_address_fields_non_null.py

示例11: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():
    op.alter_column('message', 'to_addr', existing_type=mysql.TEXT(),
                    nullable=True)
    op.alter_column('message', 'from_addr', existing_type=mysql.TEXT(),
                    nullable=True)
    op.alter_column('message', 'cc_addr', existing_type=mysql.TEXT(),
                    nullable=True)
    op.alter_column('message', 'bcc_addr', existing_type=mysql.TEXT(),
                    nullable=True) 
开发者ID:nylas,项目名称:sync-engine,代码行数:11,代码来源:064_make_address_fields_non_null.py

示例12: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():
    # downgrade method provided for convenience, but we won't get the data
    # back. Didn't need it anyway...
    op.add_column('thread', sa.Column('mailing_list_headers', mysql.TEXT(),
                                      nullable=True))
    op.add_column('message', sa.Column('mailing_list_headers', mysql.TEXT(),
                                       nullable=True)) 
开发者ID:nylas,项目名称:sync-engine,代码行数:9,代码来源:054_dont_specially_store_mailing_list_.py

示例13: upgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('cosmetics', 'css',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.alter_column('guild_members', 'active',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guild_members', 'banned',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('guilds', 'bracket_links',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'channels',
               existing_type=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('guilds', 'chat_links',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'emojis',
               existing_type=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('guilds', 'roles',
               existing_type=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('guilds', 'unauth_users',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'visitor_view',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False)
    op.alter_column('guilds', 'webhooks',
               existing_type=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=False)
    op.alter_column('unauthenticated_users', 'revoked',
               existing_type=mysql.TINYINT(display_width=1),
               type_=sa.Boolean(),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('user_css', 'css',
               existing_type=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               type_=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               existing_nullable=True)
    # ### end Alembic commands ### 
开发者ID:TitanEmbeds,项目名称:Titan,代码行数:63,代码来源:40cbd3e0f22d_moved_some_text_columns_to_longtext_type.py

示例14: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user_css', 'css',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=True)
    op.alter_column('unauthenticated_users', 'revoked',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('guilds', 'webhooks',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'visitor_view',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    op.alter_column('guilds', 'unauth_users',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'roles',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'emojis',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.TEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'chat_links',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guilds', 'channels',
               existing_type=sa.Text().with_variant(sa.Text(length=4294967295), 'mysql'),
               type_=mysql.MEDIUMTEXT(collation=u'utf8mb4_unicode_ci'),
               existing_nullable=False)
    op.alter_column('guilds', 'bracket_links',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('guild_members', 'banned',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'0'"))
    op.alter_column('guild_members', 'active',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False,
               existing_server_default=sa.text(u"'1'"))
    op.alter_column('cosmetics', 'css',
               existing_type=sa.Boolean(),
               type_=mysql.TINYINT(display_width=1),
               existing_nullable=False)
    # ### end Alembic commands ### 
开发者ID:TitanEmbeds,项目名称:Titan,代码行数:63,代码来源:40cbd3e0f22d_moved_some_text_columns_to_longtext_type.py

示例15: downgrade

# 需要导入模块: from sqlalchemy.dialects import mysql [as 别名]
# 或者: from sqlalchemy.dialects.mysql import TEXT [as 别名]
def downgrade():
    op.create_table(
        'lens',
        sa.Column('public_id', sa.BINARY(length=16), nullable=False),
        sa.Column('created_at', mysql.DATETIME(), nullable=False),
        sa.Column('updated_at', mysql.DATETIME(), nullable=False),
        sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
        sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
        sa.Column('namespace_id', mysql.INTEGER(display_width=11),
                  autoincrement=False, nullable=False),
        sa.Column('subject', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('thread_public_id', sa.BINARY(length=16), nullable=True),
        sa.Column('started_before', mysql.DATETIME(), nullable=True),
        sa.Column('started_after', mysql.DATETIME(), nullable=True),
        sa.Column('last_message_before', mysql.DATETIME(), nullable=True),
        sa.Column('last_message_after', mysql.DATETIME(), nullable=True),
        sa.Column('any_email', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('to_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('from_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('cc_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('bcc_addr', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('filename', mysql.VARCHAR(length=255), nullable=True),
        sa.Column('tag', mysql.VARCHAR(length=255), nullable=True),
        sa.ForeignKeyConstraint(['namespace_id'], [u'namespace.id'],
                                name=u'lens_ibfk_1', ondelete=u'CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        mysql_default_charset=u'utf8mb4',
        mysql_engine=u'InnoDB'
    )
    op.create_table(
        'webhook',
        sa.Column('public_id', sa.BINARY(length=16), nullable=False),
        sa.Column('created_at', mysql.DATETIME(), nullable=False),
        sa.Column('updated_at', mysql.DATETIME(), nullable=False),
        sa.Column('deleted_at', mysql.DATETIME(), nullable=True),
        sa.Column('id', mysql.INTEGER(display_width=11), nullable=False),
        sa.Column('namespace_id', mysql.INTEGER(display_width=11),
                  autoincrement=False, nullable=False),
        sa.Column('lens_id', mysql.INTEGER(display_width=11),
                  autoincrement=False, nullable=False),
        sa.Column('callback_url', mysql.TEXT(), nullable=False),
        sa.Column('failure_notify_url', mysql.TEXT(), nullable=True),
        sa.Column('include_body', mysql.TINYINT(display_width=1),
                  autoincrement=False, nullable=False),
        sa.Column('max_retries', mysql.INTEGER(display_width=11),
                  server_default='3', autoincrement=False, nullable=False),
        sa.Column('retry_interval', mysql.INTEGER(display_width=11),
                  server_default='60', autoincrement=False, nullable=False),
        sa.Column('active', mysql.TINYINT(display_width=1), server_default='1',
                  autoincrement=False, nullable=False),
        sa.Column('min_processed_id', mysql.INTEGER(display_width=11),
                  server_default='0', autoincrement=False, nullable=False),
        sa.ForeignKeyConstraint(['lens_id'], [u'lens.id'],
                                name=u'webhook_ibfk_2', ondelete=u'CASCADE'),
        sa.ForeignKeyConstraint(['namespace_id'], [u'namespace.id'],
                                name=u'webhook_ibfk_1', ondelete=u'CASCADE'),
        sa.PrimaryKeyConstraint('id'),
        mysql_default_charset=u'utf8mb4',
        mysql_engine=u'InnoDB'
    ) 
开发者ID:nylas,项目名称:sync-engine,代码行数:62,代码来源:091_remove_webhooks.py


注:本文中的sqlalchemy.dialects.mysql.TEXT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。