dbt-duckdb
dbt-duckdb copied to clipboard
PRAGMA
Hi,
This is awesome!
Would it be possible to set pragma globally?
I'd like to tweak some DuckDB settings.
Thanks very much,
PHil.
Ah you mean like beyond what can be done with the built-in “settings” construct?
You can use dbt-duckdb plugins to do any kind of customization of the DuckDB connection that you want before a set of dbt model runs occurs; the motherduck and postgres plugins that ship with the project illustrate how to do it.
Docs are here: https://github.com/jwills/dbt-duckdb#configuring-dbt-duckdb-plugins
Thanks, I've checked the docs and I'm not sure how I would implement using the instructions there (probably just me!).
I'll elaborate: basically I'm having issues when a type conversion fails. The runtime error (which I presume comes from DuckDB rather than dbt according to the dbt docs) does not specify which column had the type conversion, so debugging relies on querying many columns using trial and error.
I wanted to check DuckDB external logs using:
-- Set a path for query logging PRAGMA log_query_path='/tmp/duckdb_log/';
Again, thanks for this and for responding so quickly. If I'd built my project with just Python and DuckDB, it would've been tonnes more code and a lot less elegant!
Phil.
The log_query_path
is a setting, so you can specify it like:
SET log_query_path = '/tmp/duckdb_log/';
...which you can express in a dbt profile config like this:
default:
outputs:
dev:
type: duckdb
path: /tmp/dbt.duckdb
settings:
log_query_path: '/tmp/duckdb_log/'
target: dev
That's great, I didn't realise it was so straightforward!
Thanks again for all your work,
Phil.