-
Notifications
You must be signed in to change notification settings - Fork 175
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CT-852] [CT-836] [Bug] externalbrowser authenticator opens a browser tab for each dbt thread #198
Comments
Thanks for opening @Tolsto! I'm going to transfer this to the |
@Tolsto Sorry you're running into this — it's definitely not the intended behavior, nor the behavior I've been seeing while running dbt does open separate connections for each thread, and doesn't reuse connections between threads. For some authentication methods, each connection requires its own auth handshake (#201). If you're using
|
The caching works but only after the first invocation of dbt (and authentication). As soon as the token expires, dbt shows the mentioned behaviour. I should add that several of my co-workers experience the same issues (on non-M1 Macs). |
@Tolsto Ah, okay, got it! Glad to hear the caching works generally, and that this is just an issue when re-authenticating. Are you materializing your models in multiple logical databases? That is, do you have multiple I've been able to reproduce this behavior by configuring multiple. At the start of each invocation, dbt runs caching queries in its main thread:
|
Yes, we have multiple databases. |
Is this issue fixed in any version of dbt-snowflake yet? Or is there any workaround by updating the local configuration? or anything else? |
I had this issue when I install dbt using brew, then I uninstall the dbt and re-install it using pip, the issue was gone. I thing the installation packages are different between them . Give it a try and good luck . |
Thanks @yingqiaozheng . I removed the brew version and re-installed with pip. Unfortunately, I have the same behavior - infinite loop of tabs opening affirming the snowflake connection, but dbt doesn't seem to accept it. |
I have the same behaviour, and it's a bit annoying! Doing a fix on this ?🙏🏾🙏🏾 or a workaround? |
We're also seeing a ton of browser tabs opened. Looking at the dbt.log, it appears that it's opening a separate connection per database, per schema. It seems like it's not just the model materialization databases its considering, but also the databases of sources as well - that or our project is referencing another project. Maybe it's reasonable to require that each 'database' is a different connection in non-snowflake databases, but since snowflake databases are more like a schema, and schema like a sub-schema, it feels like there's an assumption that isn't holding up well. (Maybe snowflake's additional scoping has lead to us organizing data in a way that other databases would consider an antipattern, which makes it tricky for a multi-database tool like dbt) Could dbt treat a snowflake account as a single database for connection purposes and switch between databases/schemas/roles in sql when something needs to run in a specific context? I think that would still require a connection per-thread, but it's a lot better than per-database, per-schema by about 2 orders of magnitude in our case. Another alternative might be for snowflake to provide a way to get a time-limited token back from a general connection that could be used to create new connections without needing to use the original authentication method. |
Looks like the limited time token already exists: https://docs.snowflake.com/en/sql-reference/parameters.html#label-allow-id-token https://docs.getdbt.com/reference/warehouse-setups/snowflake-setup#sso-authentication Sounds like Tolsto already is using the keyring approach, so the issues with expiration may still apply |
I'm a bit puzzled about what we can do here. @Tolsto do you still experience the issue? Have you tried this workaround? |
Still have the problem, connection caching is activated. |
That makes sense, thank you. I'll mark that as an enhancement then. The code is working as expected, but it needs to be changed to optimize the behavior. |
It's mildly annoying. However, I have to explain to all new dbt users why this is happening as everybody thinks that something is wrong with their setup. |
This issue has been marked as Stale because it has been open for 180 days with no activity. If you would like the issue to remain open, please comment on the issue or else it will be closed in 7 days. |
Although we are closing this issue as stale, it's not gone forever. Issues can be reopened if there is renewed community interest. Just add a comment to notify the maintainers. |
Commenting to signify continued interest; this would greatly improve the development experience! |
This is an ongoing annoyance! We use around 20 database/schema combinations and each opens a tab.
Not show stopping but definitely highest annoyance. |
I am also having this issue with externalbrowser auth with Snowflake. We use 4 threads, and on first connect we get 4 browser tab popups for auth - of which only one or so can actually work - but after that it's good to go. Problem is we have to pkill dbt and rerun for it to work. This auth lasts for a while until the token expires. My team's solution has become to limit threads in dev to 1, but this limits performance. Would love to see a PR to address this! |
I set reuse_connections to True and now it opens 3 tabs, instead of 83, two of which look like they are for the history. Still a bug, but at least its manageable. |
+1 |
Is there an existing issue for this?
Current Behavior
Running dbt with Snowflake and
authenticator: externalbrowser
will open a browser login tab for each dbt thread.Expected Behavior
Only a single browser window/tab should open regardless how many threads are configured.
Steps To Reproduce
Execute
dbt run
with the following config (assuming you have at least 4 models to utilize all threads)Relevant log output
No response
Environment
What database are you using dbt with?
snowflake
Additional Context
No response
The text was updated successfully, but these errors were encountered: