You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
The content you are editing has changed. Please copy your edits and refresh the page.
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 tocast
for types that don't support a try / safe cast, e.g. in snowflake).dbt-adapters
cast
macro dbt-adapters#84cast
macro dbt-adapters#173dbt-postgres
cast
macro dbt-postgres#76cast
macro dbt-postgres#77dbt-redshift
cast
macro dbt-redshift#804cast
macro dbt-redshift#805dbt-snowflake
cast
macro dbt-snowflake#1009cast
macro dbt-snowflake#1010dbt-bigquery
cast
macro dbt-bigquery#1214cast
macro dbt-bigquery#1215dbt-spark
cast
macro dbt-spark#1028cast
macro dbt-spark#1029Documentation
cast
macro docs.getdbt.com#5278The text was updated successfully, but these errors were encountered: