Skip to content

Commit 1d15a76

Browse files
committed
better notes about CASTs
1 parent eeb476f commit 1d15a76

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,16 @@ backup-and-swap-in functionality work properly. Given how SQLite aggressively
126126
[locks](https://sqlite.org/lockingv3.html) the database anyway, it's probably
127127
not worth the effort.
128128

129-
- When inspecting the data types of columns, SQLite returns a blank value for
130-
columns in views (even if it's the result of a CAST) and in certain cases
131-
for columns in tables. These will show up in the generated docs as type 'UNKNOWN'.
129+
- It's often idiomatic with dbt to use plentiful CASTs. The results of CASTs in
130+
SQLite are tricky and depend on how the model is materialized. In a nutshell,
131+
using table materializations gives better results.
132+
133+
- When materialized as a view, the resulting column type from any CAST (or
134+
any expression) will always be empty. The SQLite adapter will regard this
135+
column type as 'UNKNOWN'.
136+
137+
- When materialized as a table, a CAST will result in the specified type for
138+
INT, REAL, TEXT; casts to NUMERIC and BOOLEAN result in a 'NUM' column type.
132139

133140
## SQLite Extensions
134141

0 commit comments

Comments
 (0)