Skip to content

Mika via Elementary: Optimize marketing_ads model for performance and maintainability #398

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

joostboon
Copy link
Collaborator

Changes

This PR optimizes the marketing_ads model with several improvements:

  1. Replaced SELECT * with explicit column selection

    • Improves query performance by only retrieving needed columns
    • Makes dependencies explicit and easier to understand
    • Prevents unexpected issues if source schemas change
  2. Added proper incremental logic

    • The model was configured as incremental but lacked the filtering logic
    • Added {% if is_incremental() %} filters to each CTE to only process new records
    • This will significantly improve processing time for incremental runs
  3. Fixed column naming

    • Corrected utm_campain typo to utm_campaign
    • Ensures consistent naming across models
  4. Restructured SQL for readability

    • Each union component now has explicit column selection
    • Consistent column ordering in SELECT statements
    • Added whitespace for better readability

These changes maintain the same functionality while improving performance and maintainability.

Created by: [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant