list_schemas() error handling suggestion #1236
paperlinguist
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
While troubleshooting the following error, I was tripped up enough that I thought to check to see if we could improve the error handling in the list_schemas function here inside dbt/adapters/snowflake/imply.py:L150
When attempting to execute a build command, I received the below error. I am using the dbt-cli updated to the latest version (1.0.0.38.21). I don't believe this error is specific to the dbt-cli so figured this discussion was best had here. Our snowflake instance (and dbt for that matter) are behind Okta for Oauth (if that should even play a factor here).
If we look at the code for list_schemas, we can see how this message gets generated:
I think it might be a good idea to add some additional context or handling that might improve the speed to resolution when troubleshooting this error. In my case, I needed to reconnect my Snowflake account in the DBT web UI (I also tried just re-generating my dbt cli personal access token and that didn't do the trick on its own). It took me longer than necessary to troubleshoot due to how this error presents itself. As a Database Error, my first thought was it was Snowflake permissions related so I spent a long time trying to hunt this one down and it doesn't come up in online discussions and occurs before the adapter even hits Snowflake to execute the query.
Before I create and submit a PR for something like this, is this even something we want to do from a philosophical standpoint? Is this situation even possible in any other configuration of dbt web IDE/dbt-core/dbt-cli and snowflake?
I think that something like the example change below might be a helpful addition but it adds extra code and cycles for the new if loop and string test. We are doing a similar string test in a few spots (get_columns_in_relation has one just a few lines later) but is this something we want to be in the habit of doing? Are there other errors we can improve? I think it makes the product more user-friendly and might intercept some chatter in the dbt slack, in the issues/feedback in google, and general user pain. Also the error is less useful because it occurs before you even interact with Snowflake and needs to be fixed in DBT.
Proposed change:
I think that's generic enough to at least point the user in a better direction as this matches the text on the button they actually need to click to fix it in the Snowflake Web UI:
Beta Was this translation helpful? Give feedback.
All reactions