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

[CT-3483] Support Semantic Layer timezone configs #9263

Open
1 task done
QMalcolm opened this issue Dec 9, 2023 · 3 comments
Open
1 task done

[CT-3483] Support Semantic Layer timezone configs #9263

QMalcolm opened this issue Dec 9, 2023 · 3 comments
Labels
Impact: CA Impact: SL Refinement Maintainer input needed semantic Issues related to the semantic layer user docs [docs.getdbt.com] Needs better documentation

Comments

@QMalcolm
Copy link
Contributor

QMalcolm commented Dec 9, 2023

Housekeeping

  • I am a maintainer of dbt-core

Short description

The Semantic Layer currently uses timezone-agnostic types for all date/time operations, but forcing people to coerce to UTC and then back-convert on render is cumbersome at best and impossible at worst. We have real-world examples of people running into date boundary issues where they have customer data stored in the customer-local timezone, and they want to compute daily customer-specific metrics with the boundaries set for that customer's local day (rather than UTC or whatever).

For situations like that it's natural to store the date/time information in local time with timezone annotations intact, as this makes common query types more natural and also allows for things like audits against local time values.

Currently , the only work-around is to normalize the time stamp in the warehouse (via the underlying dbt model) ahead of time, or else to use the expr field to do it on the fly when the semantic model is constructed. This is somewhat limiting, as it does not allow for re-use of the same measure against different time zones.

To better support timezone information we need to expand the definition of TIME type Dimensions. Specifically a timezone attribute should be added to the Dimension type_params

dimensions:
  - name: date_time
    type: time
    type_params:
      time_granularity: day
      timezone: pst # New

Acceptance criteria

People can specify a timezone property on dimensions.

Impact to Other Teams

  • Semantic Layer - The semantic layer can't begin using this until we support it
  • Cloud artifacts - This change will change the v12 manifest that goes out with 1.8

Will backports be required?

Not sure if required, but the SL team would prefer a backport to 1.7

Context

This issue should not be considered ready to work on until the work is done in dbt-semantic-interfaces, because the schema we need to implement isn't finalized until that point. Currently there does exist an issue for this work in dbt-semantic-interfaces.

@github-actions github-actions bot changed the title Support Semantic Layer timezone configs [CT-3483] Support Semantic Layer timezone configs Dec 9, 2023
@QMalcolm QMalcolm added Impact: CA Impact: SL Refinement Maintainer input needed user docs [docs.getdbt.com] Needs better documentation semantic Issues related to the semantic layer labels Dec 9, 2023
@martynydbt martynydbt added this to the v1.9 milestone Feb 12, 2024
@QMalcolm
Copy link
Contributor Author

Should this be a location name instead of a timezone abbreviation? @Jstein77

@aranke
Copy link
Member

aranke commented Feb 20, 2024

List of timezones natively supported in Python: pytz.all_timezones_set

@dbeatty10
Copy link
Contributor

I'd advocate for using tz database names (like America/Boise) rather than non-standardized abbreviations (like MST).

All of the following return names from the tz database:

The tz database is also known as:

  • tzdata
  • zoneinfo database
  • IANA time zone database
  • Olson database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impact: CA Impact: SL Refinement Maintainer input needed semantic Issues related to the semantic layer user docs [docs.getdbt.com] Needs better documentation
Projects
None yet
Development

No branches or pull requests

5 participants