CachedDataSource
Model Examples
Examples of using the Model Class are in the Examples section at the bottom of this page. AWS Model setup and deployment are quite complicated to do manually but the Workbench Model Class makes it a breeze!
CachedDataSource: Caches the method results for Workbench DataSources
CachedDataSource
Bases: CachedArtifactMixin
, AthenaSource
CachedDataSource: Caches the method results for Workbench DataSources
Note: Cached method values may lag underlying DataSource changes.
Common Usage
Source code in src/workbench/cached/cached_data_source.py
__init__(data_uuid, database='workbench')
details(**kwargs)
Retrieve the DataSource Details.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of details about the DataSource |
health_check(**kwargs)
Retrieve the DataSource Health Check.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of health check details for the DataSource |
Source code in src/workbench/cached/cached_data_source.py
smart_sample()
Retrieve the Smart Sample for this DataSource.
Returns:
Type | Description |
---|---|
DataFrame
|
pd.DataFrame: The Smart Sample DataFrame |
summary(**kwargs)
Retrieve the DataSource Details.
Returns:
Name | Type | Description |
---|---|---|
dict |
dict
|
A dictionary of details about the DataSource |
workbench_meta()
Retrieve the Workbench Metadata for this DataSource.
Returns:
Type | Description |
---|---|
Union[dict, None]
|
Union[dict, None]: Dictionary of Workbench metadata for this Artifact |
Source code in src/workbench/cached/cached_data_source.py
Examples
All of the Workbench Examples are in the Workbench Repository under the examples/
directory. For a full code listing of any example please visit our Workbench Examples
Pull DataSource Details
from workbench.cached.cached_data_source import CachedDataSource
# Grab a DataSource
ds = CachedDataSource("abalone_data")
# Show the details
ds.details()
> ds.details()
{'uuid': 'abalone_data',
'health_tags': [],
'aws_arn': 'arn:aws:glue:x:table/workbench/abalone_data',
'size': 0.070272,
'created': '2024-11-09T20:42:34.000Z',
'modified': '2024-11-10T19:57:52.000Z',
'input': 's3://workbench-public-data/common/aBaLone.CSV',
'workbench_health_tags': '',
'workbench_correlations': {'length': {'diameter': 0.9868115846024996,