# Getting intermediate table counts

**URL:** <https://discourse.getdbt.com/t/getting-intermediate-table-counts/15600>\
**Category:** Help\
**Tags:** jinja, materialization, dbt-core\
**Created:** [September 26, 2024, 6:46am UTC](https://discourse.getdbt.com/t/getting-intermediate-table-counts/15600 "2024-09-26T06:46:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scrap8498](https://sea2.discourse-cdn.com/flex020/user_avatar/discourse.getdbt.com/scrap8498/32/4630_2.png) [@Scrap8498](https://discourse.getdbt.com/u/Scrap8498)\
**Post date:** [September 26, 2024, 6:46am UTC](https://discourse.getdbt.com/t/getting-intermediate-table-counts/15600/1 "2024-09-26T06:46:39Z")

</div>

I have a question  
Suppose we a model and we have intermediate tables in them, for debugging purpose i want count of rows of those intermediate table formed before the final select statement, how to do this?

Consider the code  
with data as (  
select \* from {{ source(‘db’, ‘lookup’) }}  
),  
filtered as (  
select \* from data where forb\_ind = ‘N’  
),  
filter2 as (  
select \* from filtered where cycle\_ind = ‘Y’  
)

select \* from filter2;

So from here i want to log count of data, filter, filter2 in terminal
