Prism
v0.1.9rc2
v0.1.9rc2
  • 👋Welcome to Prism!
  • Getting Started
    • Installation
    • Creating your first project
    • Why Prism?
  • Fundamentals
    • Tasks
      • tasks
      • hooks
        • hooks.sql
        • hooks.spark
        • hooks.dbt_ref
    • Targets
      • Multiple targets
    • Config files
      • prism_project.py
        • RUN_ID / SLUG
        • SYS_PATH_CONF
        • THREADS
        • PROFILE_YML_PATH / PROFILE
        • PRISM_LOGGER
        • TRIGGERS_YML_PATH / TRIGGERS
      • Profile YML
      • Triggers YML
    • Jinja
      • __file__ and Path
      • prism_project
      • wkdir
      • parent_dir
      • concat
      • env
  • Adapters
    • Overview
    • sql
      • BigQuery
      • Postgres
      • Redshift
      • Snowflake
      • Trino
    • PySpark
    • dbt
  • Agents
    • Overview
    • Docker
    • EC2
  • CLI
    • Command Line Interface
    • init
    • compile
    • connect
    • create
      • agent
      • task
      • trigger
    • graph
    • run
    • spark-submit
    • agent
      • apply
      • run
      • build
      • delete
  • Advanced features
    • Concurrency
    • Logging
    • Triggers
    • Retries
    • Python Client
  • API Reference
    • prism.task.PrismTask
    • @task(...)
    • @target(...)
    • @target_iterator(...)
    • tasks.ref(...)
    • hooks.sql(...)
    • hooks.dbt_ref(...)
  • Use Cases
    • Analytics on top of dbt
    • Machine Learning
  • Wiki
    • DAGs
Powered by GitBook
On this page
  1. API Reference

hooks.dbt_ref(...)

Function used to retrieve already materialized dbt models as Pandas DataFrames.

Previoushooks.sql(...)NextAnalytics on top of dbt

Last updated 1 year ago

hooks.dbt_ref(adapter_name: str, target_1: str, target_2: Optional[str] = None, target_version: Optional[str] = None)

  • Parameters

    • adapter_name: the adapter defined in the projects to execute the query

    • target_1: dbt model (or package)

    • target_2: dbt model (if target_1 is a package). Default is None.

    • target_version: the versioned model to use. Default is None, in which case the latest version is. See for more details.

Warning: hooks.dbt_ref does NOT materialize your models for you! You'll need to materialize them yourselve (e.g., with dbt run) before using Prism's hooks.

  • Example:

import prism.task
import prism.target
import prism.decorators

import pandas as pd

class GetDbtModel(prism.task.PrismTask):
    
    def run(self, tasks, hooks):
        df: pd.DataFrame = hooks.dbt_ref("my_model")
        return df
from prism.decorators import task

def get_dbt_model(tasks, hooks):
    df: pd.DataFrame = hooks.dbt_ref("my_model")
    return df
profile YML
here