本文整理汇总了Python中sqlalchemy.dialects.postgresql.HSTORE属性的典型用法代码示例。如果您正苦于以下问题:Python postgresql.HSTORE属性的具体用法?Python postgresql.HSTORE怎么用?Python postgresql.HSTORE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类sqlalchemy.dialects.postgresql
的用法示例。
在下文中一共展示了postgresql.HSTORE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_postgresql_hstore_subtypes
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def test_postgresql_hstore_subtypes(self):
eq_ignore_whitespace(
autogenerate.render._repr_type(HSTORE(), self.autogen_context),
"postgresql.HSTORE(text_type=sa.Text())",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
HSTORE(text_type=String()), self.autogen_context
),
"postgresql.HSTORE(text_type=sa.String())",
)
eq_ignore_whitespace(
autogenerate.render._repr_type(
HSTORE(text_type=BYTEA()), self.autogen_context
),
"postgresql.HSTORE(text_type=postgresql.BYTEA())",
)
assert (
"from sqlalchemy.dialects import postgresql"
in self.autogen_context.imports
)
示例2: test_should_postgresql_hstore_convert
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def test_should_postgresql_hstore_convert():
assert get_field(postgresql.HSTORE()).type == graphene.JSONString
示例3: test_hstore
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def test_hstore(self):
self.test_hashable_flag(
postgresql.HSTORE(),
[{"a": "1", "b": "2", "c": "3"}, {"d": "4", "e": "5", "f": "6"}],
)
示例4: setup
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def setup(self):
metadata = MetaData()
self.test_table = Table(
"test_table",
metadata,
Column("id", Integer, primary_key=True),
Column("hash", HSTORE),
)
self.hashcol = self.test_table.c.hash
示例5: test_ret_type_text
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def test_ret_type_text(self):
col = column("x", HSTORE())
is_(col["foo"].type.__class__, Text)
示例6: test_ret_type_custom
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def test_ret_type_custom(self):
class MyType(types.UserDefinedType):
pass
col = column("x", HSTORE(text_type=MyType))
is_(col["foo"].type.__class__, MyType)
示例7: define_tables
# 需要导入模块: from sqlalchemy.dialects import postgresql [as 别名]
# 或者: from sqlalchemy.dialects.postgresql import HSTORE [as 别名]
def define_tables(cls, metadata):
Table(
"data_table",
metadata,
Column("id", Integer, primary_key=True),
Column("name", String(30), nullable=False),
Column("data", HSTORE),
)