HomeInterview QuestionsWhat is the difference between ref and source func…

What is the difference between ref and source functions?

🟡 Medium Conceptual Junior level
1Times asked
Jul 2026Last seen
Jul 2026First seen

💡 Model Answer

The ref() function in dbt is a reference to another dbt model, creating a dependency that dbt tracks for build order and incremental logic. It also allows you to use the model’s name in a portable way across environments. The source() function, on the other hand, points to a table that lives outside the dbt project, such as a raw table in a staging schema. It is used for documentation, tests, and to keep track of lineage, but it does not create a build dependency. In short, ref() is for internal models, source() is for external tables.

This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.

🎤 Get questions like this answered in real-time

Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers — invisible to screen sharing.

Get Assisting AI — Starts at ₹500