本文整理匯總了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),
)