Python sqlalchemy_utils.JSONType() Examples
The following are 4
code examples of sqlalchemy_utils.JSONType().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
sqlalchemy_utils
, or try the search function
.
![](https://www.programcreek.com/common/static/images/search.png)
Example #1
Source File: d24877c22ab0_add_attributes_to_resource_type.py From gnocchi with Apache License 2.0 | 5 votes |
def upgrade(): op.add_column("resource_type", sa.Column('attributes', sa_utils.JSONType(),))
Example #2
Source File: 1b61e2aecb30_.py From website with MIT License | 5 votes |
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"), )
Example #3
Source File: test_converter.py From graphene-sqlalchemy with MIT License | 5 votes |
def test_should_jsontype_convert_jsonstring(): assert get_field(JSONType()).type == JSONString
Example #4
Source File: tables.py From taskflow with Apache License 2.0 | 4 votes |
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)