whylogs.api.writer.gcs#

Module Contents#

Classes#

GCSWriter

A whylogs writer to upload DatasetProfileViews onto Google Cloud Storage (GCS).

Attributes#

whylogs.api.writer.gcs.logger#
class whylogs.api.writer.gcs.GCSWriter(gcs_client: Optional[google.cloud.storage.Client] = None, object_name: Optional[str] = None, bucket_name: Optional[str] = None)#

Bases: whylogs.api.writer.Writer

A whylogs writer to upload DatasetProfileViews onto Google Cloud Storage (GCS).

>**IMPORTANT**: In order to correctly connect to your GCS container, make sure you have the following environment variables set: [GOOGLE_APPLICATION_CREDENTIALS]

Parameters
  • "your-bucket-name" (bucket_name =) –

  • "local/path/to/file" (source_file_name =) –

  • "storage-object-name" (destination_blob_name =) –

  • gcs_client (Optional[google.cloud.storage.Client]) –

  • object_name (Optional[str]) –

  • bucket_name (Optional[str]) –

Returns

Return type

None

Examples

An example usage of this method can be represented with the simple code above. Here we are assuming the user has already assigned a pandas.DataFrame to the df variable.

```python import whylogs as why

profile = why.log(pandas=df) profile.writer(“gcs”).option(bucket_name=”my_bucket”).write() ```

write(file: whylogs.api.writer.writer.Writable, dest: Optional[str] = None, **kwargs: Any) Tuple[bool, str]#
Parameters
Return type

Tuple[bool, str]

option(bucket_name: Optional[str] = None, object_name: Optional[str] = None, gcs_client: Optional[Any] = None) GCSWriter#
Parameters
  • bucket_name (Optional[str]) –

  • object_name (Optional[str]) –

  • gcs_client (Optional[Any]) –

Return type

GCSWriter

check_interval(interval_seconds: int) None#

Validate an interval configuration for a given writer.

Some writers only accepts certain interval configuration. Raise BadConfigError for an unacceptable interval.

Parameters

interval_seconds (int) –

Return type

None