本文整理汇总了Python中sqlalchemy_utils.JSONType方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy_utils.JSONType方法的具体用法?Python sqlalchemy_utils.JSONType怎么用?Python sqlalchemy_utils.JSONType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sqlalchemy_utils
的用法示例。
在下文中一共展示了sqlalchemy_utils.JSONType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: upgrade
# 需要导入模块: import sqlalchemy_utils [as 别名]
# 或者: from sqlalchemy_utils import JSONType [as 别名]
def upgrade():
op.add_column("resource_type",
sa.Column('attributes', sa_utils.JSONType(),))
示例2: upgrade
# 需要导入模块: import sqlalchemy_utils [as 别名]
# 或者: from sqlalchemy_utils import JSONType [as 别名]
def upgrade():
op.create_table(
"oauth",
sa.Column("id", sa.Integer(), nullable=False),
sa.Column("provider", sa.String(length=50), nullable=False),
sa.Column("created_at", sa.DateTime(), nullable=False),
sa.Column("token", JSONType(), nullable=False),
sa.Column("user_id", sa.Integer(), nullable=True),
sa.ForeignKeyConstraint(["user_id"], ["users.id"]),
sa.PrimaryKeyConstraint("id"),
)
示例3: test_should_jsontype_convert_jsonstring
# 需要导入模块: import sqlalchemy_utils [as 别名]
# 或者: from sqlalchemy_utils import JSONType [as 别名]
def test_should_jsontype_convert_jsonstring():
assert get_field(JSONType()).type == JSONString
示例4: fetch
# 需要导入模块: import sqlalchemy_utils [as 别名]
# 或者: from sqlalchemy_utils import JSONType [as 别名]
def fetch(metadata):
"""Returns the master set of table objects (which is also there schema)."""
logbooks = Table('logbooks', metadata,
Column('created_at', DateTime,
default=timeutils.utcnow),
Column('updated_at', DateTime,
onupdate=timeutils.utcnow),
Column('meta', su.JSONType),
Column('name', String(length=NAME_LENGTH)),
Column('uuid', String(length=UUID_LENGTH),
primary_key=True, nullable=False, unique=True,
default=uuidutils.generate_uuid))
flowdetails = Table('flowdetails', metadata,
Column('created_at', DateTime,
default=timeutils.utcnow),
Column('updated_at', DateTime,
onupdate=timeutils.utcnow),
Column('parent_uuid', String(length=UUID_LENGTH),
ForeignKey('logbooks.uuid',
ondelete='CASCADE')),
Column('meta', su.JSONType),
Column('name', String(length=NAME_LENGTH)),
Column('state', String(length=STATE_LENGTH)),
Column('uuid', String(length=UUID_LENGTH),
primary_key=True, nullable=False, unique=True,
default=uuidutils.generate_uuid))
atomdetails = Table('atomdetails', metadata,
Column('created_at', DateTime,
default=timeutils.utcnow),
Column('updated_at', DateTime,
onupdate=timeutils.utcnow),
Column('meta', su.JSONType),
Column('parent_uuid', String(length=UUID_LENGTH),
ForeignKey('flowdetails.uuid',
ondelete='CASCADE')),
Column('name', String(length=NAME_LENGTH)),
Column('version', String(length=VERSION_LENGTH)),
Column('state', String(length=STATE_LENGTH)),
Column('uuid', String(length=UUID_LENGTH),
primary_key=True, nullable=False, unique=True,
default=uuidutils.generate_uuid),
Column('failure', su.JSONType),
Column('results', su.JSONType),
Column('revert_results', su.JSONType),
Column('revert_failure', su.JSONType),
Column('atom_type', Enum(*models.ATOM_TYPES,
name='atom_types')),
Column('intention', Enum(*states.INTENTIONS,
name='intentions')))
return Tables(logbooks, flowdetails, atomdetails)