Create a new pipeline or open an existing pipeline.
Add a data loader.
Select Pinot.
You will get the below code snippet:
Copy
from mage_ai.data_preparation.repo_manager import get_repo_pathfrom mage_ai.io.config import ConfigFileLoaderfrom mage_ai.io.pinot import Pinotfrom os import pathif 'data_loader' not in globals(): from mage_ai.data_preparation.decorators import data_loaderif 'test' not in globals(): from mage_ai.data_preparation.decorators import test@data_loaderdef load_data_from_pinot(*args, **kwargs): """ Template for loading data from a Pinot warehouse. Specify your configuration settings in 'io_config.yaml'. Docs: https://docs.mage.ai/design/data-loading#pinot """ query = 'your Pinot query' # Specify your SQL query here config_path = path.join(get_repo_path(), 'io_config.yaml') config_profile = 'default' with Pinot.with_config(ConfigFileLoader(config_path, config_profile)) as loader: return loader.load(query)@testdef test_output(output, *args) -> None: """ Template code for testing the output of the block. """ assert output is not None, 'The output is undefined'
Enter the SQL query in place of ‘your Pinot query’.