OHDSI / dbt-synthea

[Under development] A dbt ETL project to convert a Synthea synthetic data set into the OMOP CDM
Apache License 2.0
8 stars 3 forks source link

Avoid use of `safe_cast`? #68

Open lawrenceadams opened 2 hours ago

lawrenceadams commented 2 hours ago

dbt.safe_cast is used across 17 files - however, neither the postgres adapter nor duckdb support safe cast (although interestingly duckdb does support it), and so all this macro will do is use the usual ANSI style casting like so.

Given some databases we support in the future do support try_cast (for example, snowflake) we will end up with different behaviors when using different databases.

I might be missing something, but I think if there is a failed cast we would want it to properly raise an error and then debug this properly, rather than creating NULLs ?


Extends #40

lawrenceadams commented 2 hours ago

Having thought about it - maybe we should just use vanilla ANSI stye casting instead of the cast/try_cast macro, although these may handle some specific type instances I am unaware of!