# Is there a way to show only the most left handed sources/models in the DAG?

**URL:** <https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022>\
**Category:** Help\
**Tags:** node-selection\
**Created:** [February 27, 2023, 10:43pm UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022 "2023-02-27T22:43:19Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![chatwithmike](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/chatwithmike/32/1989_2.png) [@chatwithmike](https://discourse.getdbt.com/u/chatwithmike)\
**Post date:** [February 27, 2023, 10:43pm UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/1 "2023-02-27T22:43:19Z")

</div>

## The problem I’m having

I have a very large complicated DAG that I am working through. I want to identify the left most sources and/or models.

## The context of why I’m trying to do this

I’m doing this to better unravel how the existing data warehouse on which it was based works.

## What I’ve already tried

I’ve tried reading the documentation to see if there is an argument I can give the --select section of the DAG or a way to modify the ls command to get what I need.

## Some example code or error messages

```auto
  No code examples, sorry :(

```

---

<div class="post-metadata">

**Author:** ![brunoszdl](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/brunoszdl/32/4113_2.png) [@brunoszdl](https://discourse.getdbt.com/u/brunoszdl)\
**Post date:** [February 28, 2023, 12:48am UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/2 "2023-02-28T00:48:59Z")

</div>

Have you tried to see the sources/models in the lineage graph of dbt docs? I think is the easiest way to check how your models are connected.

---

<div class="post-metadata">

**Author:** ![chatwithmike](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/chatwithmike/32/1989_2.png) [@chatwithmike](https://discourse.getdbt.com/u/chatwithmike)\
**Post date:** [February 28, 2023, 1:16am UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/3 "2023-02-28T01:16:30Z")

</div>

Yeah, that 's part of the problem. Nearly a thousand tables with cycles that we had to break using dot notation. It’s a mess.

---

<div class="post-metadata">

**Author:** ![brunoszdl](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/brunoszdl/32/4113_2.png) [@brunoszdl](https://discourse.getdbt.com/u/brunoszdl)\
**Post date:** [February 28, 2023, 2:12am UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/4 "2023-02-28T02:12:25Z")

</div>

hmmm okay, but you can visualize small parts of the project using the `tags`, `select` or `exclude` options

[[Album] Imgur: The magic of the Internet ![](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/2X/1/13defd6ae70c3e99aa6ce5da0c2d2cf63770ade6.jpeg "Imgur: The magic of the Internet") ](https://imgur.com/a/2Sij1ur)

e.g. you want to visualize only the part of the project related to ‘my\_model’’

you can put inside select ‘+my\_model’, or ‘+my\_model+’. If there are yet too many models you can exclude some of them in the same way in `exclude`.

I did not understand if you already tried it, do you think this can be of some help?

---

<div class="post-metadata">

**Author:** ![joellabes](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/joellabes/32/3980_2.png) [@joellabes](https://discourse.getdbt.com/u/joellabes)\
**Post date:** [March 3, 2023, 7:05am UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/5 "2023-03-03T07:05:13Z")

</div>

In the docs viewer (or dbt ls), does this work? Writing it on mobile so haven’t checked:

`dbt ls --select source:*+1`

`source:*` would be [any source](https://docs.getdbt.com/reference/node-selection/methods#the-source-method), the `+1` means the [first-order children](https://docs.getdbt.com/reference/node-selection/graph-operators#the-n-plus-operator)

---

<div class="post-metadata">

**Author:** ![chatwithmike](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/chatwithmike/32/1989_2.png) [@chatwithmike](https://discourse.getdbt.com/u/chatwithmike)\
**Post date:** [March 3, 2023, 4:05pm UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/6 "2023-03-03T16:05:47Z")

</div>

Thanks for the thought. I have researched those suggestions but without success because the diagram is fragmented. Meaning, there are many orphaned processes where two or more tables connect to each other but not to a source and are floating out on the DAG. The datawarehouse has a lot of technical debt that I’m trying to work through as I try to migrate to the cloud.

---

<div class="post-metadata">

**Author:** ![joellabes](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/joellabes/32/3980_2.png) [@joellabes](https://discourse.getdbt.com/u/joellabes)\
**Post date:** [March 3, 2023, 10:38pm UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/7 "2023-03-03T22:38:26Z")

</div>

Hmmm sounds messy! So you’re saying that not all of the leftmost models are derived from sources, they have hardcoded references to a table?

Could you look at the manifest.json and find nodes which don’t have their depends\_on array populated? I think those would be your leftmost nodes.

---

<div class="post-metadata">

**Author:** ![chatwithmike](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/chatwithmike/32/1989_2.png) [@chatwithmike](https://discourse.getdbt.com/u/chatwithmike)\
**Post date:** [March 3, 2023, 11:36pm UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/8 "2023-03-03T23:36:25Z")

</div>

Ah, that did it. Thanks joellabes!

Yes, to answer your question. We had to have hardcoded references to some fact/dim tables to break circular references as we weren’t at the rewrite stage and were trying to build out a diagram to have some semblance of what was going on.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/getdbt/original/1X/a7a7ca1fe379aaf90952b0e13118a817babcd14f.png) [@system](https://discourse.getdbt.com/u/system)\
**Post date:** [March 10, 2023, 11:37pm UTC](https://discourse.getdbt.com/t/is-there-a-way-to-show-only-the-most-left-handed-sources-models-in-the-dag/7022/9 "2023-03-10T23:37:25Z")

</div>

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
