Here are the examples of the python api sqlalchemy_utils.JSONType taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
0
Example 1
def upgrade():
op.add_column("resource_type",
sa.Column('attributes', sa_utils.JSONType(),))
0
Example 2
Project: taskflow Source File: tables.py
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)