Comments (5)
Thank you @Btwitzke for raising this issue.
Do you have any suggestion on where to specify the session properties for Trino within dbt
?
What do you think about specifying them, in the same fashion as the http_headers
within the trino dbt profile?
from dbt-trino.
Thanks for the quick response @findinpath !
I think that there are 2 ways of looking at this:
-
As you mentioned, since this is going into the actual connection then it could be specified in the trino dbt profile along with the rest of the connection details. This would be a good place to start for this.
-
To expand functionality in another step, it is sometimes desired to specify different session variables for different models, rather than a wholesale connection variable in the profile. An example is raising the amount of task writers when knowing that a model produces larger data files and not wanting so many writers when a model has a small amount of data. In that sense, the optimal way would be the ability to specify session variables in the same type of 'pre-hook' syntax within a model or in the dbt_project.yml.
from dbt-trino.
@Btwitzke the 2nd point you've raised points rather to a one off "hint" for Trino that you want to use for a specific query.
Do you have a recipe for such a scenario when interacting directly with Trino?
dbt offers pre-hook
and post-hook
https://docs.getdbt.com/reference/resource-configs/pre-hook-post-hook
which can be used to SET SESSION
/ RESET SESSION
I still need to test this, but i assume that this feature request for one off queries doesn't require any implementation.
Global session properties would probably make sense to be implemented via dbt/profiles.yml config file.
from dbt-trino.
@findinpath Yes, a hint it a way to put it. Setting the session variables within a pre-hook currently does not actually effect the running queries. It appears that upon a new transaction, a new connection is made which resets the session properties of course. I tested running 'set session' queries in a pre-hook, and these do NOT persist into the corresponding model query. I think that is because a pre-hook is actually run as a separate query before the model.
If there was the ability to set session properties in the profiles.yml that would also work for this case, and most likely the simplest solution since those variables essentially already persist into the connections made.
from dbt-trino.
@Btwitzke I had a look on the dbt logs when testing the changes from @hovaesco and it seems that after each query, a new Trino connection is being opened:
Opening a new connection, currently in state closed
This generate the loss of the settings set on pre-hook.
For now, we can use the session properties set in the profiles.yml
dbt file.
Please do create a new issue if you have an idea on how to make use of session properties that are to be applied only on a specific query.
from dbt-trino.
Related Issues (20)
- Support CASCADE dropping relations
- Solving for large stage depths HOT 3
- Support `CREATE OR REPLACE` HOT 2
- get_relation not working as already_exists HOT 4
- deltalake rename managed table not allowed arised HOT 1
- Failed to connect to Trino cluster using LDAP auth and HTTP connection HOT 3
- Extra credentials in connection HOT 3
- Not able to create snapshot of a model using dbt-trino==1.7.1 HOT 4
- Refactor to use dbt-adapters interface layer HOT 2
- merge_exclude_columns doesn't work
- upgrade to support dbt-core v1.8.0 HOT 1
- Add REPLACE strategy to incremental materialization
- Executing 'dbt docs generate' when the 'where' clause has different combinations of schemas > produces a permission error HOT 3
- Running codegen to generate source yaml fails HOT 1
- Add partition by in configs for incremental materialization HOT 2
- Custom TrinoCredentials support
- Incremental Materialization Macro Uses Variables Before Defined HOT 3
- When running "dbt test --store-fallures" trino reports "destination table XXX already exists" HOT 3
- Support for persist_docs in Starburst Galaxy HOT 1
- __dbt_tmp suffix in table location HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dbt-trino.