Incremental model not based on dates

Hey all,

The problem I’m having is that I’m trying to create an incremental model based on int type column - days from signup.
I’m querying an event table and aggregating it to granularity of days_from_signup, company, user (and the action).
The table is extremely heavy, and I’ll need to do it for 2 more event’s tables.

Because the granularity do no contains dates, how can I get the max date/partition from this table?
Here’s an example of my query (without the incremental syntax):

select
    CEILING(timestamp_diff(eh.dateCreated, a.signupTimestamp, minute)/1440) days_from_signup,
    company,
    userId,

    {{ events_calculations() }} -- contains 20+ simple calculations (sum, count...)

from {{ref('events_table')}} eh
JOIN {{ref('companies')}} a on eh.company = a.company
group by 1,2,3

Events_table has a daily partition called “pt”, and each date has a field called dateCreated, which is the time when the event occurred.

Thanks :slight_smile:

Not sure if I understood, Is your table partitioned? If so, which column is used to partition the table?

I want my table to be partitioned and incremental.
The src table I’m querying from is partitioned by date (pt).