Snowflake-Labs/sfguide-data-engineering-with-snowpark-python

Error getting snowsql config details

scwin813 opened this issue · 0 comments

When running the 02_load_raw.py file, there is an error as seen below.

`Traceback (most recent call last):
File ".\sfguide-data-engineering-with-snowpark-python\utils\snowpark_utils.py", line 74, in get_snowsql_config
session_config = config[connection_path]
File ".\miniconda3\envs\pysnowpark\lib\configparser.py", line 960, in getitem
raise KeyError(key)
KeyError: 'connections.dev'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "02_load_raw.py", line 76, in
session = snowpark_utils.get_snowpark_session()
File ".\sfguide-data-engineering-with-snowpark-python\utils\snowpark_utils.py", line 28, in get_snowpark_session
snowpark_config = get_snowsql_config()
File ".\sfguide-data-engineering-with-snowpark-python\utils\snowpark_utils.py", line 82, in get_snowsql_config
raise Exception(
Exception: Error getting snowsql config details`

This error occurs because the code looks for the variable connections.dev in my snowsql config file. In my case, this connection was not named dev but a more specific name.

[connections.snowpark_login] accountname = myaccount.west-europe.azure username = my_user password = my_password
Thus it cannot find login details in the config file. I fixed it for now by hardcoding my own naming at line 54 in the snowpark_utils.py file but there should either be a dynamic way to search for the login credentials or the quickstart should specify explicitly that you need to name the connection in this way.