Skip to content
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

Making your date calculation for stg_hashmap_snowflake_daily_usage future proof #6

Open
DubKF opened this issue Jun 14, 2020 · 0 comments

Comments

@DubKF
Copy link

DubKF commented Jun 14, 2020

Hi Randy,

I've enjoyed your YT video about DBT and though a little tip might help you to adjust your sequence rowcount usage with something more future proof. I ran into the same problem a while ago myself and solved it by combining hints from Snowflake forums and Stack Overflow.

The parameter approach I'l describe also avoids some sequence oddities when using larger values as outlined in Mark's and Peter's comments.

While Snowflake has the limitation of generators requiring a "constant" value, you can use a parameter instead of a constant. This effectively "freezes" you calculated value, but updates it with each run of e.g. a stored procedure. I'd suggest to use the lowest date you currently have as base for your calculation in the parameter as outlined in my answer on Stackoverflow.

Little self promo - in case you think that approach is useful, feel free to like my SO answer as well ;)

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

No branches or pull requests

1 participant