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 cast macro #9976

Closed
15 of 16 tasks
dbeatty10 opened this issue Apr 18, 2024 · 2 comments
Closed
15 of 16 tasks

[Epic] Cross-database cast macro #9976

dbeatty10 opened this issue Apr 18, 2024 · 2 comments
Assignees
Labels
stale Issues that have gone stale

Comments

@dbeatty10
Copy link
Contributor

dbeatty10 commented Apr 18, 2024

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

Implementation

The cast function is specified in ISO/IEC 9075-2 (part 2 of the SQL standard), so there is a natural adapter-agnostic implementation:

cast({{ expression }} as {{ data_type }})

Utility

It can be useful for end-users when they are looking for an adapter-agnostic method to cast a SQL expression to a specific data type.

Having a cross-database cast macro has been suggested as a way to address a variety of things including, but not limited to:

For example, it can be useful in implementations of safe_cast (falling back to cast for types that don't support a try / safe cast, e.g. in snowflake).

dbt-adapters

Preview Give feedback
  1. MichelleArk
  2. enhancement
    dbeatty10

dbt-postgres

Preview Give feedback
  1. cla:yes

dbt-redshift

Preview Give feedback
  1. cla:yes

dbt-snowflake

Preview Give feedback
  1. cla:yes
  2. cla:yes

dbt-bigquery

Preview Give feedback
  1. cla:yes

dbt-spark

Preview Give feedback
  1. cla:yes

Documentation

Preview Give feedback
  1. content dbt-core v1.8 size: small
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 Nov 10, 2024
Copy link
Contributor

Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 17, 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