examples/airline-demo/airline_demo/solids.py
def upload_to_s3(context, file_obj):
    '''Upload a file to s3.

    Args:
        info (ExpectationExecutionInfo): Must expose a boto3 S3 client as its `s3` resource.

    Returns:
        (str, str):
            The bucket and key to which the file was uploaded.
    '''
    bucket = context.solid_config['bucket']
    key = context.solid_config['key']

    context.resources.s3.put_object(
        Bucket=bucket, Body=file_obj.read(), Key=key, **(context.solid_config.get('kwargs') or {})
    )
    yield Result(bucket, 'bucket')
    yield Result(key, 'key')
def upload_to_s3(context, file_obj):
    '''Upload a file to s3.

    Args:
        info (ExpectationExecutionInfo): Must expose a boto3 S3 client as its `s3` resource.

    Returns:
        (str, str):
            The bucket and key to which the file was uploaded.
    '''
    bucket = context.solid_config['bucket']
    key = context.solid_config['key']

    context.resources.s3.put_object(
        Bucket=bucket, Body=file_obj.read(), Key=key, **(context.solid_config.get('kwargs') or {})
    )
    yield Result(bucket, 'bucket')
    yield Result(key, 'key')
Upload a file to s3.

    Args:
        info (ExpectationExecutionInfo): Must expose a boto3 S3 client as its `s3` resource.

    Returns:
        (str, str):
            The bucket and key to which the file was uploaded.