当前位置: 首页>>代码示例>>Python>>正文


Python sqlalchemy.LargeBinary方法代码示例

本文整理汇总了Python中sqlalchemy.LargeBinary方法的典型用法代码示例。如果您正苦于以下问题:Python sqlalchemy.LargeBinary方法的具体用法?Python sqlalchemy.LargeBinary怎么用?Python sqlalchemy.LargeBinary使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sqlalchemy的用法示例。


在下文中一共展示了sqlalchemy.LargeBinary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('passentry',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('connectiondate', sa.String(length=20), nullable=True),
    sa.Column('password', sa.LargeBinary(length=500), nullable=True),
    sa.Column('salt', sa.LargeBinary(length=500), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_passentry_connectiondate'), 'passentry', ['connectiondate'], unique=False)
    op.create_index(op.f('ix_passentry_password'), 'passentry', ['password'], unique=False)
    op.create_index(op.f('ix_passentry_salt'), 'passentry', ['salt'], unique=False)
    op.create_table('target_pass',
    sa.Column('target_id', sa.Integer(), nullable=False),
    sa.Column('logentry_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['logentry_id'], ['passentry.id'], ),
    sa.ForeignKeyConstraint(['target_id'], ['target.id'], ),
    sa.PrimaryKeyConstraint('target_id', 'logentry_id')
    )
    # ### end Alembic commands ### 
开发者ID:LibrIT,项目名称:passhport,代码行数:22,代码来源:7e10f8660fa5_.py

示例2: _cast

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def _cast(t, expr):
    arg, typ = expr.op().args

    sa_arg = t.translate(arg)
    sa_type = t.get_sqla_type(typ)

    # specialize going from an integer type to a timestamp
    if isinstance(arg.type(), dt.Integer) and isinstance(sa_type, sa.DateTime):
        return sa.func.timezone('UTC', sa.func.to_timestamp(sa_arg))

    if arg.type().equals(dt.binary) and typ.equals(dt.string):
        return sa.func.encode(sa_arg, 'escape')

    if typ.equals(dt.binary):
        #  decode yields a column of memoryview which is annoying to deal with
        # in pandas. CAST(expr AS BYTEA) is correct and returns byte strings.
        return sa.cast(sa_arg, sa.LargeBinary())

    return sa.cast(sa_arg, sa_type) 
开发者ID:ibis-project,项目名称:ibis,代码行数:21,代码来源:compiler.py

示例3: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    op.create_table(
        'asset',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('result_id', sa.Integer(), nullable=False),
        sa.Column('summary', sa.String(length=1024), nullable=True),
        sa.Column('file_modified_at', sa.DateTime(), nullable=False),
        sa.ForeignKeyConstraint(['result_id'], ['result.id'], ),
        sa.PrimaryKeyConstraint('id')
    )
    op.create_table(
        'bindata',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('asset_id', sa.Integer(), nullable=False),
        sa.Column('name', sa.String(length=1024), nullable=False),
        sa.Column('tag', sa.String(length=1024), nullable=True),
        sa.Column('note', sa.String(length=1024), nullable=True),
        # < 10MB
        sa.Column('content', sa.LargeBinary(length=1e7), nullable=False),
        sa.ForeignKeyConstraint(['asset_id'], ['asset.id'], ),
        sa.PrimaryKeyConstraint('id')
    ) 
开发者ID:chainer,项目名称:chainerui,代码行数:24,代码来源:6cd7f193a3de_create_data.py

示例4: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    conn = op.get_bind()

    temp_log_table = op.create_table(
        'temp_log',
        sa.Column('id', sa.Integer(), nullable=False),
        sa.Column('result_id', sa.Integer(), nullable=True),
        sa.Column('data', sa.LargeBinary(length=2048), nullable=True),
        sa.ForeignKeyConstraint(['result_id'], ['result.id'], ),
        sa.PrimaryKeyConstraint('id'))
    res = conn.execute('SELECT id, result_id, data FROM log')
    results = res.fetchall()
    if len(results) > 0:
        modified_logs = [{
            'id': r[0],
            'result_id': r[1],
            'data': msgpack.packb(json.loads(r[2]), use_bin_type=True)}
            for r in results]
        op.bulk_insert(temp_log_table, modified_logs)
    op.drop_table('log')
    op.rename_table('temp_log', 'log') 
开发者ID:chainer,项目名称:chainerui,代码行数:23,代码来源:e3db52a480f8_alter_log_data_type.py

示例5: init_database

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def init_database():

    Base = declarative_base()

    class Model(Base):
        __tablename__ = 'models'
        TS_name = Column(String(250), nullable=False,primary_key=True)
        TS_winner_name = Column(String(250), nullable=False)
        TS_model = Column(LargeBinary())
        TS_model_params = Column(String(250))
        TS_metric = Column(Numeric)
        TS_update = Column('TS_update', DATETIME, index=False, nullable=False,primary_key=True,default=datetime.datetime.utcnow)

    class TS(Base):
        __tablename__ = 'timeseries'
        TS_name = Column(String(250), nullable=False,primary_key=True)
        TS_data = Column(Text())
        TS_update = Column('TS_update', DATETIME, index=False, nullable=False,primary_key=True,default=datetime.datetime.utcnow)


    DB_NAME = 'sqlite:///Timecop_modelsv1.db'
    engine = create_engine(DB_NAME)
    #self.__db.echo = True
    Base.metadata.create_all(engine) 
开发者ID:BBVA,项目名称:timecop,代码行数:26,代码来源:BBDD.py

示例6: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    op.create_table('profiles',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('data', sa.LargeBinary(), nullable=True),
                    sa.Column('payload_type', sa.String(), nullable=True),
                    sa.Column('description', sa.Text(), nullable=True),
                    sa.Column('display_name', sa.String(), nullable=True),
                    sa.Column('expiration_date', sa.DateTime(), nullable=True),
                    sa.Column('identifier', sa.String(), nullable=False),
                    sa.Column('organization', sa.String(), nullable=True),
                    sa.Column('uuid', commandment.dbtypes.GUID(), nullable=True),
                    sa.Column('removal_disallowed', sa.Boolean(), nullable=True),
                    sa.Column('version', sa.Integer(), nullable=True),
                    sa.Column('scope', sa.Enum('User', 'System', name='payloadscope'), nullable=True),
                    sa.Column('removal_date', sa.DateTime(), nullable=True),
                    sa.Column('duration_until_removal', sa.BigInteger(), nullable=True),
                    sa.Column('consent_en', sa.Text(), nullable=True),
                    sa.Column('is_encrypted', sa.Boolean(), nullable=True),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.create_index(op.f('ix_profiles_uuid'), 'profiles', ['uuid'], unique=True) 
开发者ID:cmdmnt,项目名称:commandment,代码行数:23,代码来源:5b98cc4af6c9_create_profiles_table.py

示例7: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    op.create_table('scep_payload',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('url', sa.String(), nullable=False),
                    sa.Column('name', sa.String(), nullable=True),
                    sa.Column('subject', commandment.dbtypes.JSONEncodedDict(), nullable=False),
                    sa.Column('challenge', sa.String(), nullable=True),
                    sa.Column('key_size', sa.Integer(), nullable=False),
                    sa.Column('ca_fingerprint', sa.LargeBinary(), nullable=True),
                    sa.Column('key_type', sa.String(), nullable=False),
                    sa.Column('key_usage', sa.Enum('Signing', 'Encryption', 'All', name='keyusage'), nullable=True),
                    sa.Column('subject_alt_name', sa.String(), nullable=True),
                    sa.Column('retries', sa.Integer(), nullable=False),
                    sa.Column('retry_delay', sa.Integer(), nullable=False),
                    sa.Column('certificate_renewal_time_interval', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(['id'], ['payloads.id'], ),
                    sa.PrimaryKeyConstraint('id')
                    ) 
开发者ID:cmdmnt,项目名称:commandment,代码行数:20,代码来源:e5840df9a88a_create_scep_payload_table.py

示例8: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    if not has_table('runs'):
        return

    if not has_table('snapshots'):
        op.create_table(
            'snapshots',
            sa.Column('id', sa.Integer, primary_key=True, autoincrement=True, nullable=False),
            sa.Column('snapshot_id', sa.String(255), unique=True, nullable=False),
            sa.Column('snapshot_body', sa.LargeBinary, nullable=False),
            sa.Column('snapshot_type', sa.String(63), nullable=False),
        )

    if not has_column('runs', 'snapshot_id'):
        op.add_column(
            'runs',
            sa.Column('snapshot_id', sa.String(255), sa.ForeignKey('snapshots.snapshot_id')),
        ) 
开发者ID:dagster-io,项目名称:dagster,代码行数:20,代码来源:c63a27054f08_add_snapshots_to_run_storage.py

示例9: test_large_type_deprecation

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def test_large_type_deprecation(self):
        d1 = mssql.dialect(deprecate_large_types=True)
        d2 = mssql.dialect(deprecate_large_types=False)
        d3 = mssql.dialect()
        d3.server_version_info = (11, 0)
        d3._setup_version_attributes()
        d4 = mssql.dialect()
        d4.server_version_info = (10, 0)
        d4._setup_version_attributes()

        for dialect in (d1, d3):
            eq_(str(Text().compile(dialect=dialect)), "VARCHAR(max)")
            eq_(str(UnicodeText().compile(dialect=dialect)), "NVARCHAR(max)")
            eq_(str(LargeBinary().compile(dialect=dialect)), "VARBINARY(max)")

        for dialect in (d2, d4):
            eq_(str(Text().compile(dialect=dialect)), "TEXT")
            eq_(str(UnicodeText().compile(dialect=dialect)), "NTEXT")
            eq_(str(LargeBinary().compile(dialect=dialect)), "IMAGE") 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:21,代码来源:test_types.py

示例10: test_python_type

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def test_python_type(self):
        eq_(types.Integer().python_type, int)
        eq_(types.Numeric().python_type, decimal.Decimal)
        eq_(types.Numeric(asdecimal=False).python_type, float)
        eq_(types.LargeBinary().python_type, util.binary_type)
        eq_(types.Float().python_type, float)
        eq_(types.Interval().python_type, datetime.timedelta)
        eq_(types.Date().python_type, datetime.date)
        eq_(types.DateTime().python_type, datetime.datetime)
        eq_(types.String().python_type, str)
        eq_(types.Unicode().python_type, util.text_type)
        eq_(types.Enum("one", "two", "three").python_type, str)

        assert_raises(
            NotImplementedError, lambda: types.TypeEngine().python_type
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:18,代码来源:test_types.py

示例11: test_comparison

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def test_comparison(self, connection):
        """test that type coercion occurs on comparison for binary"""

        expr = binary_table.c.data == "foo"
        assert isinstance(expr.right.type, LargeBinary)

        data = os.urandom(32)
        connection.execute(binary_table.insert(), data=data)
        eq_(
            connection.scalar(
                select([func.count("*")])
                .select_from(binary_table)
                .where(binary_table.c.data == data)
            ),
            1,
        ) 
开发者ID:sqlalchemy,项目名称:sqlalchemy,代码行数:18,代码来源:test_types.py

示例12: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    op.add_column(
        'keypairs',
        sa.Column('dotfiles', sa.LargeBinary(length=64 * 1024), nullable=False, server_default='\\x90')
    ) 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:7,代码来源:1e8531583e20_add_dotfile_column_to_keypairs.py

示例13: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    op.add_column('kernels', sa.Column('container_log', sa.LargeBinary(), nullable=True)) 
开发者ID:lablup,项目名称:backend.ai-manager,代码行数:4,代码来源:51dddd79aa21_add_logs_column_on_kernel_table.py

示例14: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():   # noqa: D103
    # There can be data truncation here as LargeBinary can be smaller than the pickle
    # type.
    # use batch_alter_table to support SQLite workaround
    with op.batch_alter_table("xcom") as batch_op:
        batch_op.alter_column('value', type_=sa.LargeBinary()) 
开发者ID:apache,项目名称:airflow,代码行数:8,代码来源:bdaa763e6c56_make_xcom_value_column_a_large_binary.py

示例15: upgrade

# 需要导入模块: import sqlalchemy [as 别名]
# 或者: from sqlalchemy import LargeBinary [as 别名]
def upgrade():
    # Add the table for API keys
    op.create_table('apikey',
            sa.Column('id', sa.Integer(), nullable=False),
            sa.Column('timestamp', sa.DateTime, nullable=False),
            sa.Column('user_id', sa.Integer(), nullable=False),
            sa.Column('key', sa.LargeBinary(length=32), nullable=False),
            sa.ForeignKeyConstraint(['user_id'], ['user.id']),
            sa.PrimaryKeyConstraint('id')) 
开发者ID:paxswill,项目名称:evesrp,代码行数:11,代码来源:3d35f833a24_.py


注:本文中的sqlalchemy.LargeBinary方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。