how to get the distinct value of a column from the dbt model temp staging tables

Hi Team,
Problem statement :
I have a dbt model which reads data from the source, performs the aggregation, and loads to a physical target table.

Granularity of source data = Daily (Field - dt, Values - 2023-01-01, 2023-01-02,…, 2023-12-01, 2023-12-02, 2023-12-03)
Granularity of target data = Monthly (Field - month, values - 2023-Jan, 2023-Feb, 2023-Mar, —, 2023-Nov, 2023-Dec)

I am triggering the dbt model via python, and when the dbt model completes, I want to get the month values generated to the python. I don’t want to scan the entire target table to find these values.

Since dbt creates a __dbt__tmp staging table, is it possible to write a jinja code or macro to query the __dbt__tmp table and get the values outside to python

any other suggestion?