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


Python types.UnicodeText方法代码示例

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


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

示例1: define_showcase_package_association_table

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def define_showcase_package_association_table():
    global showcase_package_assocation_table

    showcase_package_assocation_table = Table(
        'showcase_package_association', metadata,
        Column('package_id', types.UnicodeText,
               ForeignKey('package.id',
                          ondelete='CASCADE',
                          onupdate='CASCADE'),
               primary_key=True, nullable=False),
        Column('showcase_id', types.UnicodeText,
               ForeignKey('package.id',
                          ondelete='CASCADE',
                          onupdate='CASCADE'),
               primary_key=True, nullable=False)
    )

    mapper(ShowcasePackageAssociation, showcase_package_assocation_table) 
开发者ID:ckan,项目名称:ckanext-showcase,代码行数:20,代码来源:__init__.py

示例2: test_no_convert_unicode

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def test_no_convert_unicode(self):
        """test no utf-8 encoding occurs"""

        dialect = sqlite.dialect()
        for t in (
            String(),
            sqltypes.CHAR(),
            sqltypes.Unicode(),
            sqltypes.UnicodeText(),
            String(),
            sqltypes.CHAR(),
            sqltypes.Unicode(),
            sqltypes.UnicodeText(),
        ):
            bindproc = t.dialect_impl(dialect).bind_processor(dialect)
            assert not bindproc or isinstance(
                bindproc(util.u("some string")), util.text_type
            ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:20,代码来源:test_sqlite.py

示例3: test_mssql_column_types

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def test_mssql_column_types(self):
        def assert_type(type_string, type_expected):
            type_assigned = MssqlEngineSpec.get_sqla_column_type(type_string)
            if type_expected is None:
                self.assertIsNone(type_assigned)
            else:
                self.assertIsInstance(type_assigned, type_expected)

        assert_type("INT", None)
        assert_type("STRING", String)
        assert_type("CHAR(10)", String)
        assert_type("VARCHAR(10)", String)
        assert_type("TEXT", String)
        assert_type("NCHAR(10)", UnicodeText)
        assert_type("NVARCHAR(10)", UnicodeText)
        assert_type("NTEXT", UnicodeText) 
开发者ID:apache,项目名称:incubator-superset,代码行数:18,代码来源:mssql_tests.py

示例4: result_processor

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def result_processor(self, dialect, coltype):
        lob_processor = _LOBMixin.result_processor(self, dialect, coltype)
        if lob_processor is None:
            return None

        string_processor = sqltypes.UnicodeText.result_processor(
            self, dialect, coltype)

        if string_processor is None:
            return lob_processor
        else:
            def process(value):
                return string_processor(lob_processor(value))
            return process 
开发者ID:jpush,项目名称:jbox,代码行数:16,代码来源:cx_oracle.py

示例5: setup_spatial_table

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def setup_spatial_table(package_extent_class, db_srid=None):

    if legacy_geoalchemy:

        package_extent_table = Table(
            'package_extent', meta.metadata,
            Column('package_id', types.UnicodeText, primary_key=True),
            GeometryExtensionColumn('the_geom', Geometry(2, srid=db_srid))
        )

        meta.mapper(
            package_extent_class,
            package_extent_table,
            properties={'the_geom':
                        GeometryColumn(package_extent_table.c.the_geom,
                                       comparator=PGComparator)}
        )

        GeometryDDL(package_extent_table)
    else:

        # PostGIS 1.5 requires management=True when defining the Geometry
        # field
        management = (postgis_version()[:1] == '1')

        package_extent_table = Table(
            'package_extent', meta.metadata,
            Column('package_id', types.UnicodeText, primary_key=True),
            Column('the_geom', Geometry('GEOMETRY', srid=db_srid,
                                        management=management)),
        )

        meta.mapper(package_extent_class, package_extent_table)

    return package_extent_table 
开发者ID:italia,项目名称:daf-recipes,代码行数:37,代码来源:geoalchemy_common.py

示例6: upgrade

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def upgrade(migrate_engine):
    metadata = MetaData()
    metadata.bind = migrate_engine

    group_table = Table('group', metadata, autoload=True)
    group_extra_table = Table('group_extra', metadata,
        Column('id', UnicodeText, primary_key=True, default=make_uuid),
        Column('group_id', UnicodeText, ForeignKey('group.id')),
        Column('key', UnicodeText),
        Column('value', JsonType),
    )
    
    group_extra_table.create() 
开发者ID:italia,项目名称:daf-recipes,代码行数:15,代码来源:022_add_group_extras.py

示例7: test_should_unicodetext_convert_string

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def test_should_unicodetext_convert_string():
    assert get_field(types.UnicodeText()).type == graphene.String 
开发者ID:graphql-python,项目名称:graphene-sqlalchemy,代码行数:4,代码来源:test_converter.py

示例8: define_showcase_admin_table

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def define_showcase_admin_table():
    global showcase_admin_table

    showcase_admin_table = Table('showcase_admin', metadata,
                                 Column('user_id', types.UnicodeText,
                                        ForeignKey('user.id',
                                                   ondelete='CASCADE',
                                                   onupdate='CASCADE'),
                                        primary_key=True, nullable=False))

    mapper(ShowcaseAdmin, showcase_admin_table) 
开发者ID:ckan,项目名称:ckanext-showcase,代码行数:13,代码来源:__init__.py

示例9: result_processor

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def result_processor(self, dialect, coltype):
        lob_processor = _LOBMixin.result_processor(self, dialect, coltype)
        if lob_processor is None:
            return None

        string_processor = sqltypes.UnicodeText.result_processor(self, dialect, coltype)

        if string_processor is None:
            return lob_processor
        else:
            def process(value):
                return string_processor(lob_processor(value))
            return process 
开发者ID:binhex,项目名称:moviegrabber,代码行数:15,代码来源:cx_oracle.py

示例10: _fixed_lookup_fixture

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def _fixed_lookup_fixture(self):
        return [
            (sqltypes.String(), sqltypes.VARCHAR()),
            (sqltypes.String(1), sqltypes.VARCHAR(1)),
            (sqltypes.String(3), sqltypes.VARCHAR(3)),
            (sqltypes.Text(), sqltypes.TEXT()),
            (sqltypes.Unicode(), sqltypes.VARCHAR()),
            (sqltypes.Unicode(1), sqltypes.VARCHAR(1)),
            (sqltypes.UnicodeText(), sqltypes.TEXT()),
            (sqltypes.CHAR(3), sqltypes.CHAR(3)),
            (sqltypes.NUMERIC, sqltypes.NUMERIC()),
            (sqltypes.NUMERIC(10, 2), sqltypes.NUMERIC(10, 2)),
            (sqltypes.Numeric, sqltypes.NUMERIC()),
            (sqltypes.Numeric(10, 2), sqltypes.NUMERIC(10, 2)),
            (sqltypes.DECIMAL, sqltypes.DECIMAL()),
            (sqltypes.DECIMAL(10, 2), sqltypes.DECIMAL(10, 2)),
            (sqltypes.INTEGER, sqltypes.INTEGER()),
            (sqltypes.BIGINT, sqltypes.BIGINT()),
            (sqltypes.Float, sqltypes.FLOAT()),
            (sqltypes.TIMESTAMP, sqltypes.TIMESTAMP()),
            (sqltypes.DATETIME, sqltypes.DATETIME()),
            (sqltypes.DateTime, sqltypes.DATETIME()),
            (sqltypes.DateTime(), sqltypes.DATETIME()),
            (sqltypes.DATE, sqltypes.DATE()),
            (sqltypes.Date, sqltypes.DATE()),
            (sqltypes.TIME, sqltypes.TIME()),
            (sqltypes.Time, sqltypes.TIME()),
            (sqltypes.BOOLEAN, sqltypes.BOOLEAN()),
            (sqltypes.Boolean, sqltypes.BOOLEAN()),
            (
                sqlite.DATE(storage_format="%(year)04d%(month)02d%(day)02d"),
                sqltypes.DATE(),
            ),
            (
                sqlite.TIME(
                    storage_format="%(hour)02d%(minute)02d%(second)02d"
                ),
                sqltypes.TIME(),
            ),
            (
                sqlite.DATETIME(
                    storage_format="%(year)04d%(month)02d%(day)02d"
                    "%(hour)02d%(minute)02d%(second)02d"
                ),
                sqltypes.DATETIME(),
            ),
        ] 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:49,代码来源:test_sqlite.py

示例11: setup

# 需要导入模块: from sqlalchemy import types [as 别名]
# 或者: from sqlalchemy.types import UnicodeText [as 别名]
def setup():
    """
    Set up ORM.

    Does not create any database tables, see :py:func:`create_tables`
    for that.
    """
    global resource_metadata_table
    if resource_metadata_table is None:
        log.debug('Defining resource metadata table')
        resource_metadata_table = Table(
            RESOURCE_METADATA_TABLE_NAME,
            metadata,
            Column('resource_id', types.UnicodeText, ForeignKey('resource.id',
                   ondelete='CASCADE', onupdate='CASCADE'), nullable=False,
                   primary_key=True),
            Column('last_extracted', types.DateTime),
            Column('last_url', types.UnicodeText),
            Column('last_format', types.UnicodeText),
            Column('task_id', types.UnicodeText)
        )
        mapper(
            ResourceMetadata,
            resource_metadata_table,
            properties={
                '_meta': relationship(ResourceMetadatum, collection_class=
                                      attribute_mapped_collection('key'),
                                      cascade='all, delete, delete-orphan'),
            }
        )
    else:
        log.debug('Resource metadata table already defined')
    global resource_metadatum_table
    if resource_metadatum_table is None:
        log.debug('Defining resource metadatum table')
        resource_metadatum_table = Table(
            RESOURCE_METADATUM_TABLE_NAME,
            metadata,
            Column('id', types.Integer, nullable=False, primary_key=True),
            Column('resource_id', types.UnicodeText, ForeignKey(
                   RESOURCE_METADATA_TABLE_NAME + '.resource_id',
                   ondelete='CASCADE', onupdate='CASCADE'), nullable=False),
            Column('key', types.UnicodeText, nullable=False),
            Column('value', types.UnicodeText)
        )
        mapper(ResourceMetadatum, resource_metadatum_table)
    else:
        log.debug('Resource metadatum table already defined') 
开发者ID:stadt-karlsruhe,项目名称:ckanext-extractor,代码行数:50,代码来源:model.py


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