Skip to content

Optimize runtime#193

Merged
fivetran-jamie merged 44 commits intorelease/1.5.0from
optimize-runtime
Apr 16, 2026
Merged

Optimize runtime#193
fivetran-jamie merged 44 commits intorelease/1.5.0from
optimize-runtime

Conversation

@fivetran-jamie
Copy link
Copy Markdown
Contributor

@fivetran-jamie fivetran-jamie commented Mar 16, 2026

PR Overview

Package version introduced in this PR:

  • 1.5.0-a1
  • 1.5.0-a2
  • 1.5.0

This PR addresses the following Issue/Feature(s):

  • GA-1012518

Summary of changes:

Submission Checklist

  • Alignment meeting with the reviewer (if needed)
    • Timeline and validation requirements discussed
  • Provide validation details:
    • Validation Steps: Check for unintentional effects (e.g., add/run consistency & integrity tests)
    • Testing Instructions: Confirm the change addresses the issue(s)
    • Focus Areas: Complex logic or queries that need extra attention
  • Merge any relevant open PRs into this PR

Changelog

  • Draft changelog for PR
  • Final changelog for release review

@fivetran-jamie fivetran-jamie self-assigned this Mar 16, 2026
@fivetran-jamie fivetran-jamie changed the title Optimize runtime Optimize runtime + incremental variable Mar 16, 2026
@fivetran-jamie fivetran-jamie added the docs:ready Triggers the docs generator workflow. label Mar 16, 2026
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md Outdated
Comment thread CHANGELOG.md
Comment thread CHANGELOG.md Outdated
@fivetran-jamie fivetran-jamie marked this pull request as ready for review March 16, 2026 21:23
@fivetran-jamie fivetran-jamie removed the docs:ready Triggers the docs generator workflow. label Mar 17, 2026
@fivetran-joemarkiewicz fivetran-joemarkiewicz added the docs:ready Triggers the docs generator workflow. label Mar 17, 2026
@fivetran-joemarkiewicz fivetran-joemarkiewicz added the pre-release Triggers the auto-releaser workflow. label Mar 17, 2026
Comment on lines +18 to +20
partition_by = ({'field': '_fivetran_synced_date', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date']) if transaction_level
else ({'field': 'accounting_period_ending', 'data_type': 'date', 'granularity': 'month'}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary since _fivetran_synced_date is not present in the aggregated version

if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date']) if transaction_level
else ({'field': 'accounting_period_ending', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['accounting_period_ending']),
cluster_by = ['transaction_id'] if transaction_level else ['account_id', 'accounting_period_id'],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary since transaction_id is not present in the aggregated version

Comment on lines +17 to +20
partition_by = ({'field': '_fivetran_synced_date', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date']) if transaction_level
else ({'field': 'accounting_period_ending', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['accounting_period_ending']),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary since _fivetran_synced_date is not present in the aggregated version

if target.type not in ['spark', 'databricks'] else ['_fivetran_synced_date']) if transaction_level
else ({'field': 'accounting_period_ending', 'data_type': 'date', 'granularity': 'month'}
if target.type not in ['spark', 'databricks'] else ['accounting_period_ending']),
cluster_by = ['transaction_id'] if transaction_level else ['account_id', 'accounting_period_id'],
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary since transaction_id is not present in the aggregated version

@fivetran-jamie fivetran-jamie changed the title Optimize runtime + incremental variable Optimize runtime Apr 9, 2026
@fivetran-jamie fivetran-jamie added docs:ready Triggers the docs generator workflow. and removed docs:ready Triggers the docs generator workflow. labels Apr 10, 2026
@fivetran-jamie fivetran-jamie added the pre-release Triggers the auto-releaser workflow. label Apr 10, 2026
@fivetran-jamie fivetran-jamie changed the base branch from main to release/1.5.0 April 13, 2026 15:57
{% do surrogate_key_fields.append('to_subsidiary_id') if using_to_subsidiary_and_exchange_rate %}
{% do surrogate_key_fields.append('accounting_book_id') if multibook_accounting_enabled %}
surrogate_key as (
{% set surrogate_key_fields = ['source_relation', 'transaction_line_id', 'transaction_id', 'accounting_period_id', 'account_name', 'account_id'] if transaction_level else ['source_relation', 'accounting_period_id', 'account_name', 'account_id', 'subsidiary_id'] %}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

had to add subsidiary_id in for the aggregated case

Comment thread models/netsuite2.yml Outdated
Comment thread models/netsuite2/netsuite2__income_statement.sql Outdated
Comment thread models/netsuite2/netsuite2__income_statement.sql Outdated

{% if is_incremental() %}
where _fivetran_synced_date >= {{ netsuite.netsuite_lookback(from_date='max(_fivetran_synced_date)', datepart='day', interval=lookback_window) }}
{% if transaction_level %}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this necessary since we already know the incremental config will only be used if the model is configured for transaction_level. Otherwise, no incremental strategy is used.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this was necessary for Buildkite. Also if Core users want to override the configs to aggregate + run incrementally this will make things work for them

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like we take a somewhat different approach to aggregating in the income_statement model vs the balance_sheet. In the balance sheet model we first aggregate and then do all dimensional joins. In the income statement we do all dimensional joins and then aggregate.

The approach in the balance sheet looks more performant. Is there a reason there are two different approaches used across the models?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, adjusting

Comment thread README.md
Comment thread README.md Outdated
Comment thread DECISIONLOG.md
Comment thread .quickstart/quickstart.yml Outdated
Comment thread models/netsuite2/netsuite2__balance_sheet.sql
Comment thread models/netsuite2.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to also update the model descriptions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lmk if I should update them in the README as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes let's update the README to reflect the different states of the model. In the README let's not be highly technical, but explain the two states and how they can be toggled.

Copy link
Copy Markdown
Contributor

@fivetran-joemarkiewicz fivetran-joemarkiewicz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small requests, but ready to go once updates are applied and docs are regenerated.

Comment thread DECISIONLOG.md Outdated
Comment thread models/netsuite2.yml
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes let's update the README to reflect the different states of the model. In the README let's not be highly technical, but explain the two states and how they can be toggled.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread models/netsuite2.yml Outdated
The Cumulative Translation Adjustment total, which in most cases does not have transactions associated with it, is calculated manually.
columns:
- name: transaction_id
description: Netsuite internal transaction ID.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add to these descriptions that these fields are only present when the aggregate variables are set to false. Let's apply to all the impacted fields.

@fivetran-joemarkiewicz
Copy link
Copy Markdown
Contributor

Also, looks like there are some merge conflicts to address from the patch release before merging.

@fivetran-jamie
Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

@fivetran-jamie fivetran-jamie merged commit a093a74 into release/1.5.0 Apr 16, 2026
6 of 10 checks passed
@fivetran-jamie fivetran-jamie mentioned this pull request Apr 16, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs:ready Triggers the docs generator workflow. pre-release Triggers the auto-releaser workflow.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants