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

[Epic] Cross-database date macro #10075

Open
13 of 14 tasks
dbeatty10 opened this issue May 1, 2024 · 1 comment
Open
13 of 14 tasks

[Epic] Cross-database date macro #10075

dbeatty10 opened this issue May 1, 2024 · 1 comment
Labels
stale Issues that have gone stale

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented May 1, 2024

This epic comprises the changes across dbt Labs repos necessary to implement a cross-database date macro as described in dbt-labs/dbt-adapters#192.

Implementation

There is no equivalent function specified in ISO/IEC 9075 (the SQL standard), so there is not a natural adapter-agnostic implementation from them.

However, many database vendors support a to_date function with syntax similar to the following:

to_date('{{ iso_8601_formatted_date }}', 'YYYY-MM-DD')

So we can utilize that as the base implementation and adapters can customize as-needed.

Utility

This function is also generally useful anytime someone wants to generate SQL to create an scalar DATE value by supplying an explicit year, month, day combo.

An expected use is supplying a start and end date to dbt.date_spine.

For example, #8825 describes how we'd like to automatically create a metricflow_time_spine model if the project defines any semantic objects, and that relies upon being able to do a cross-database dbt.date_spine given an explicit start and end date.

dbt-adapters

  1. enhancement refinement user docs
    dbeatty10
  2. cla:yes user docs

dbt-postgres

  1. cla:yes

dbt-redshift

  1. cla:yes

dbt-snowflake

  1. cla:yes

dbt-bigquery

  1. cla:yes

dbt-spark

  1. cla:yes

Documentation

  1. content dbt Core dbt-core v1.8 improvement
    nghi-ly
Copy link
Contributor

This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues that have gone stale label Oct 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Issues that have gone stale
Projects
None yet
Development

No branches or pull requests

1 participant