-
Notifications
You must be signed in to change notification settings - Fork 47
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
Allow specifying a timezone #56
Comments
@prratek just getting around to this, sorry about the delay! I'd love to better understand your use case here. My major concern is that timezone's being a part of the macro could break one of the key tenets of the metrics package:
If Person A over in accounting is interested in ARR by their local timezone and Person B in finance is interested in ARR by UTC, they'll get different answers and we fall back into the same world that we existed in beforehand. Here are a few thoughts:
The latter is how we're doing it right now but I believe that it is slightly unintentional. We could explicitly callout that timezones are the responsibility of the model writer/maintainer. Caveat: This could be complicated with custom calendars. If your custom calendar is in a timezone and your model is in another timezone, the joins could be a bit funky. |
@callum-mcdata I'm solving for the use case where I have a table where my temporal column is a UTC timestamp but I'd like to enforce that when a metric is calculated by day/week/month that it be done in Eastern time. I hear you that this likely isn't something we'd want to leave up to the user querying for the metric - we're not trying to provide timezone flexibility to the end user. With that concern in mind, maybe it would make sense to be able to configure a timezone in the metric definition itself, and |
@prratek following up on this after a few weeks with my head down. Directionally I am aligned on this idea - I think it makes sense to have this be an optional attribute at the metric level. Unfortunately that means we'd need to go into the belly of the beast ( More importantly, are you interested in exploring adding this logic through the use of meta flags to test that it works? More than happy to meet and discuss where that would fit into the package architecture. |
@prratek in the interest of carrying this to its logical conclusion, is there any reason why you wouldn't cast the |
@callum-mcdata sorry it took me a while to get to this! while you could do that, we've been operating on the principle that it's best practice for all timestamps to be in UTC. It "feels" more consistent with the So to answer your question, we could in theory cast all our timestamp columns, but it wouldn't be worth the tradeoff. |
@dave-connors-3 this makes logical sense to me and feels like something that we'd probably want to include in the @prratek Dave has been working on #96 which takes advantage of new functionality in 1.3 to support config settings at the metric level. Does it make sense to you that this would be able to be passed as a config paramater? IE it could be set at the individual metric level OR set at the project level like model configs. |
I think with the assumption that yes, timezones are something that should be configurable, the |
Makes sense to me too! |
Hi! I am also facing this issue in the dbt_metrics. All the DBT project uses a specific timezone (Europe/Paris) and we would like to have this option in the metrics definition. Hope this option will be added in the future! |
👋 hey folks! I'm doing some new years cleaning of issues and wanted to flag this as a I'd recommend reading through this PR that @dave-connors-3 released last year. This functionality would most likely take form in a We would then need to most likely make changes to |
After some more thought, I'm actually going to close out this issue - any I've linked this issue to corresponding |
Since calculating a metric typically involves truncating a timestamp to day/week/month, it would be great to be able to configure what timezone to use, maybe as an additional optional argument to
metrics.calculate(...)
. I'm not sure whether this makes more sense as something to support in the dbt metric definition instead since people likely want to enforce use of a certain timezone for a metric calculation so open to your thoughts there.The text was updated successfully, but these errors were encountered: