Class GcsClient

Uploads Pandas DataFrame to a bucket in Google Cloud Storage.

Inheritance

builtins.object > GcsClient

Methods

ensure_bucket_exists

ensure_bucket_exists(project, region)

Checks if a bucket named '{project}-automl-tables-staging' exists.

If this bucket doesn't exist, creates one. If this bucket already exists in project, do nothing. If this bucket exists in a different project that we don't have access to, creates a bucket named '{project}-automl-tables-staging-{create_timestamp}' because bucket's name must be globally unique. Save the created bucket's name and reuse this for future requests.

Parameters
NameDescription
project str

The ID of the project that stores the bucket.

region str

The region of the bucket.

upload_pandas_dataframe

upload_pandas_dataframe(dataframe, uploaded_csv_name=None)

Uploads a Pandas DataFrame as CSV to the bucket.

Parameters
NameDescription
dataframe pandas.DataFrame

The Pandas Dataframe to be uploaded.

uploaded_csv_name Optional[str]

The name for the uploaded CSV.