Exemplo n.º 1
0
def save_gzip_json_to_s3(obj,
                         bucket,
                         key,
                         save_format='json',
                         intelligent_tiering=True):
    json_str = _get_json_str(obj, save_format=save_format)
    gz_str = gzip_string(json_str, f'assembled_stmts.{save_format}')
    s3_put(bucket=bucket,
           key=key,
           body=gz_str,
           unsigned_client=False,
           intelligent_tiering=intelligent_tiering)
Exemplo n.º 2
0
def save_gzip_json_to_s3(obj, bucket, key, save_format='json'):
    client = get_s3_client(unsigned=False)
    json_str = _get_json_str(obj, save_format=save_format)
    gz_str = gzip_string(json_str, f'assembled_stmts.{save_format}')
    client.put_object(Body=gz_str, Bucket=bucket, Key=key)
Exemplo n.º 3
0
def test_gzip_string():
    content = 'asdf'
    content_enc = s3_client.gzip_string(content, 'content')
    content_dec = zlib.decompress(content_enc, 16+zlib.MAX_WBITS)
    content_dec_uni = content_dec.decode('utf-8')
    assert content == content_dec_uni
Exemplo n.º 4
0
def test_gzip_string():
    content = 'asdf'
    content_enc = s3_client.gzip_string(content, 'content')
    content_dec = zlib.decompress(content_enc, 16 + zlib.MAX_WBITS)
    content_dec_uni = content_dec.decode('utf-8')
    assert content == content_dec_uni