Python sqlalchemy.BLOB Examples

The following are 2 code examples of sqlalchemy.BLOB(). 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 , or try the search function .
Example #1
Source File: 095_secret_storage.py    From sync-engine with GNU Affero General Public License v3.0 6 votes vote down vote up
def upgrade():
    # SECRETS TABLE:
    # Can just drop this, was't really used before
    op.drop_column('secret', 'acl_id')

    op.alter_column('secret', 'type', type_=sa.Enum('password', 'token'),
                    existing_server_default=None,
                    existing_nullable=False)

    op.add_column('secret', sa.Column('encryption_scheme', sa.Integer(),
                                      server_default='0', nullable=False))
    op.add_column('secret', sa.Column('_secret', sa.BLOB(),
                                      nullable=False))

    # Account tables:
    # Don't need to change column types for password_id, refresh_token_id;
    # only add foreign key indices.
    op.create_foreign_key('genericaccount_ibfk_2', 'genericaccount', 'secret',
                          ['password_id'], ['id'])
    op.create_foreign_key('gmailaccount_ibfk_2', 'gmailaccount', 'secret',
                          ['refresh_token_id'], ['id'])
    op.create_foreign_key('outlookaccount_ibfk_2', 'outlookaccount', 'secret',
                          ['refresh_token_id'], ['id']) 
Example #2
Source File: 52a6ff8551e1_.py    From moa with MIT License 5 votes vote down vote up
def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('bridge', sa.Column('settings', sa.BLOB(), nullable=True))
    # ### end Alembic commands ###