snowflakedb / snowflake-connector-python

Snowflake Connector for Python
https://pypi.python.org/pypi/snowflake-connector-python/
Apache License 2.0
601 stars 473 forks source link

SNOW-1616604: default config location does not work on Windows #2018

Closed sfc-gh-pczajka closed 3 months ago

sfc-gh-pczajka commented 3 months ago

Python version

Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug 6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]

Operating system and processor architecture

Windows-11-10.0.22631-SP0

Installed packages

N/A

What did you do?

In [3]: os.path.expanduser("~/.snowflake")
Out[3]: 'C:\\Users\\PatrykCzajka/.snowflake'

# https://github.com/snowflakedb/snowflake-connector-python/blob/706bc2f6ae58da25885064497c217cfedcc19020/src/snowflake/connector/sf_dirs.py#L35

What did you expect to see?

C:\\Users\\PatrykCzajka\\.snowflake, as pathlib.Path.expanduser does

Quickfix: https://github.com/snowflakedb/snowflake-connector-python/pull/2017

Can you set logging to DEBUG and collect the logs?

import logging
import os

for logger_name in ('snowflake.connector',):
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    ch.setLevel(logging.DEBUG)
    ch.setFormatter(logging.Formatter('%(asctime)s - %(threadName)s %(filename)s:%(lineno)d - %(funcName)s() - %(levelname)s - %(message)s'))
    logger.addHandler(ch)