Import the required classes and initialize Athina API key.

import os
from athina_client.datasets import Dataset
from athina_client.keys import AthinaApiKey

AthinaApiKey.set_key(os.getenv('ATHINA_API_KEY'))

Get Dataset By ID

# Get a dataset by ID
try:
    dataset = Dataset.get_dataset_by_id(dataset_id=DATASET_ID)
except Exception as e:
    print(f"Failed to get dataset: {e}")

Get Dataset By Name

Dataset names are unique in Athina, which makes it possible to interact with datasets by name.

# Get a dataset by Name
try:
    dataset = Dataset.get_dataset_by_name(name="test_dataset")
except Exception as e:
    print(f"Failed to get dataset: {e}")