Python SDK Reference#
Important
This notebook is in the process of being migrated to Vast Data Platform Field Docs. It will probably not run yet.
Deploy boto3 library for S3#
We will download the boto3 standard S3 library to get data into the S3 compatible VAST Datastore
!pip install --quiet boto3 | tail -5
Setup demo environment#
Setup Python’s behavior to be more strict, including raising errors for some cases where variables are accidentally undefined.
from __future__ import annotations # Enable stricter type checking
Import some utility functions for this demo.
import sys
sys.path.insert(1, '../misc/')
from vastdb_demo_util import get_connection_vars, upload_to_s3, delete_s3_object, list_objects_in_bucket
Upload S3 Object#
import os
import boto3
from botocore.exceptions import NoCredentialsError
#upload_to_s3(local_file_path, bucket_name, s3_file_key, aws_access_key_id, aws_secret_access_key, s3_endpoint)
# List objects in the bucket
print("Uploaded Object")
list_objects_in_bucket(bucket_name, aws_access_key_id, aws_secret_access_key, s3_endpoint, prefix='')
Uploaded Object
Objects in bucket vastdb with prefix '':
nyc-taxi/2011-01.data.parquet
nyc-taxi/2011-02.data.parquet
nyc-taxi/2011-03.data.parquet
nyc-taxi/2011-04.data.parquet
nyc-taxi/2011-05.data.parquet
nyc-taxi/2011-06.data.parquet
nyc-taxi/2011-07.data.parquet
nyc-taxi/2011-08.data.parquet
nyc-taxi/2011-09.data.parquet
nyc-taxi/2011-10.data.parquet
nyc-taxi/2011-11.data.parquet
nyc-taxi/2011-12.data.parquet
nyc-taxi/2012-01.data.parquet
nyc-taxi/2012-02.data.parquet
nyc-taxi/2012-03.data.parquet
nyc-taxi/2012-04.data.parquet
nyc-taxi/2012-05.data.parquet
nyc-taxi/2012-06.data.parquet
nyc-taxi/2012-07.data.parquet
nyc-taxi/2012-08.data.parquet
nyc-taxi/2012-09.data.parquet
nyc-taxi/2012-10.data.parquet
nyc-taxi/2012-11.data.parquet
nyc-taxi/2012-12.data.parquet
nyc-taxi/2013-01.data.parquet
nyc-taxi/2013-02.data.parquet
nyc-taxi/2013-03.data.parquet
nyc-taxi/2013-04.data.parquet
nyc-taxi/2013-05.data.parquet
nyc-taxi/2013-06.data.parquet
nyc-taxi/2013-07.data.parquet
nyc-taxi/2013-08.data.parquet
nyc-taxi/2013-09.data.parquet
nyc-taxi/2013-10.data.parquet
nyc-taxi/2013-11.data.parquet
nyc-taxi/2013-12.data.parquet
nyc-taxi/2014-01.data.parquet
nyc-taxi/2014-02.data.parquet
nyc-taxi/2014-03.data.parquet
nyc-taxi/2014-04.data.parquet
nyc-taxi/2014-05.data.parquet
nyc-taxi/2014-06.data.parquet
nyc-taxi/2014-07.data.parquet
nyc-taxi/2014-08.data.parquet
nyc-taxi/2014-09.data.parquet
nyc-taxi/2014-10.data.parquet
nyc-taxi/2014-11.data.parquet
nyc-taxi/2014-12.data.parquet
nyc-taxi/2015-01.data.parquet
nyc-taxi/2015-02.data.parquet
nyc-taxi/2015-03.data.parquet
nyc-taxi/2015-04.data.parquet
nyc-taxi/2015-05.data.parquet
nyc-taxi/2015-06.data.parquet
nyc-taxi/2015-07.data.parquet
nyc-taxi/2015-08.data.parquet
nyc-taxi/2015-09.data.parquet
nyc-taxi/2015-10.data.parquet
nyc-taxi/2015-11.data.parquet
nyc-taxi/2015-12.data.parquet
nyc-taxi/2016-01.data.parquet
nyc-taxi/2016-02.data.parquet
nyc-taxi/2016-03.data.parquet
nyc-taxi/2016-04.data.parquet
nyc-taxi/2016-05.data.parquet
nyc-taxi/2016-06.data.parquet
nyc-taxi/2016-07.data.parquet
nyc-taxi/2016-08.data.parquet
nyc-taxi/2016-09.data.parquet
nyc-taxi/2016-10.data.parquet
nyc-taxi/2016-11.data.parquet
nyc-taxi/2016-12.data.parquet
nyc-taxi/2017-01.data.parquet
nyc-taxi/2017-02.data.parquet
nyc-taxi/2017-03.data.parquet
nyc-taxi/2017-04.data.parquet
nyc-taxi/2017-05.data.parquet
nyc-taxi/2017-06.data.parquet
nyc-taxi/2017-07.data.parquet
nyc-taxi/2017-08.data.parquet
nyc-taxi/2017-09.data.parquet
nyc-taxi/2017-10.data.parquet
nyc-taxi/2017-11.data.parquet
nyc-taxi/2017-12.data.parquet
nyc-taxi/2018-01.data.parquet
nyc-taxi/2018-02.data.parquet
nyc-taxi/2018-03.data.parquet
nyc-taxi/2018-04.data.parquet
nyc-taxi/2018-05.data.parquet
nyc-taxi/2018-06.data.parquet
nyc-taxi/2018-07.data.parquet
nyc-taxi/2018-08.data.parquet
nyc-taxi/2018-09.data.parquet
nyc-taxi/2018-10.data.parquet
nyc-taxi/2018-11.data.parquet
nyc-taxi/2018-12.data.parquet
nyc-taxi/2019-01.data.parquet
nyc-taxi/2019-02.data.parquet
nyc-taxi/2019-03.data.parquet
nyc-taxi/2019-04.data.parquet
nyc-taxi/2019-05.data.parquet
nyc-taxi/2019-06.data.parquet
tabular_schema_table
tpcds/
vastschema/taxi
print("Uploaded Object")
list_objects_in_bucket(bucket_name, aws_access_key_id, aws_secret_access_key, s3_endpoint, prefix='labimage4.png')
Uploaded Object
No objects found in bucket vastdb with prefix 'labimage4.png'.