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