snowflakedb / snowflakedb/snowflake-connector-python

SNOW-1825673: `root` can not be checked for existence of `SNOWFLAKE_HOME` due to permissions

Open
#2,108 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status-pr_pending_merge status-triage_done
Dominant language
Python
Stars
730
Forks
574
Avg merge
5h 45m
Merged PRs (30d)
16

Description

Python version

3.11

Operating system and processor architecture

Linux-5.15.0-1071-aws-aarch64-with-glibc2.35

Installed packages
annotated-types==0.7.0
asn1crypto==1.5.1
asttokens==2.0.5
astunparse==1.6.3
azure-core==1.30.1
azure-storage-blob==12.19.1
azure-storage-file-datalake==12.14.0
backcall==0.2.0
black==23.3.0
blinker==1.4
boto3==1.34.39
botocore==1.34.39
brickflows==1.2.1
cachetools==5.3.3
certifi==2023.7.22
cffi==1.15.1
chardet==4.0.0
charset-normalizer==2.0.4
click==8.1.7
cloudpickle==2.2.1
comm==0.1.2
contourpy==1.0.5
cryptography==43.0.3
cycler==0.11.0
Cython==0.29.32
databricks-sdk==0.20.0
databricks-sql-connector==3.6.0
dbus-python==1.2.18
debugpy==1.6.7
decorator==5.1.1
delta-spark==3.2.1
distlib==0.3.8
distro==1.7.0
distro-info==1.1+ubuntu0.2
entrypoints==0.4
et_xmlfile==2.0.0
executing==0.8.3
facets-overview==1.1.1
filelock==3.13.4
fonttools==4.25.0
gitdb==4.0.11
GitPython==3.1.43
google-api-core==2.18.0
google-auth==2.29.0
google-cloud-core==2.4.1
google-cloud-storage==2.16.0
google-crc32c==1.5.0
google-resumable-media==2.7.0
googleapis-common-protos==1.63.0
grpcio==1.60.0
grpcio-status==1.60.0
httplib2==0.20.2
idna==3.4
importlib-metadata==6.0.0
ipyflow-core==0.0.198
ipykernel==6.25.1
ipython==8.15.0
ipython-genutils==0.2.0
isodate==0.6.1
jedi==0.18.1
jeepney==0.7.1
Jinja2==3.1.2
jmespath==0.10.0
joblib==1.2.0
jsonpickle==4.0.0
jupyter_client==7.4.9
jupyter_core==5.3.0
keyring==23.5.0
kiwisolver==1.4.4
koheesio==0.9.0rc3
launchpadlib==1.10.16
lazr.restfulclient==0.14.4
lazr.uri==1.0.6
lz4==4.3.3
MarkupSafe==3.0.2
matplotlib==3.7.2
matplotlib-inline==0.1.6
mlflow-skinny==2.11.4
more-itertools==8.10.0
multimethod==1.12
mypy-extensions==0.4.3
nest-asyncio==1.5.6
networkx==3.1
numpy==1.26.4
oauthlib==3.2.0
openpyxl==3.1.5
packaging==23.2
pandas==1.5.3
pandas-stubs==2.2.3.241009
parso==0.8.3
pathspec==0.10.3
patsy==0.5.3
pendulum==2.1.2
pexpect==4.8.0
pickleshare==0.7.5
Pillow==9.4.0
platformdirs==3.10.0
plotly==5.9.0
pluggy==1.5.0
prompt-toolkit==3.0.36
proto-plus==1.23.0
protobuf==4.24.1
psutil==5.9.0
psycopg2==2.9.3
ptyprocess==0.7.0
pure-eval==0.2.2
py4j==0.10.9.7
pyarrow==14.0.1
pyasn1==0.4.8
pyasn1-modules==0.2.8
pyccolo==0.0.52
pycparser==2.21
pydantic==2.10.1
pydantic_core==2.27.1
Pygments==2.15.1
PyGObject==3.42.1
PyJWT==2.3.0
pyodbc==4.0.38
pyOpenSSL==24.2.1
pyparsing==3.0.9
pyspark==3.5.3
python-apt==2.4.0+ubuntu3
python-dateutil==2.8.2
python-decouple==3.8
python-lsp-jsonrpc==1.1.1
pytz==2024.2
pytzdata==2020.1
PyYAML==6.0
pyzmq==23.2.0
requests==2.31.0
rsa==4.9
s3transfer==0.10.1
scikit-learn==1.3.0
scipy==1.11.1
seaborn==0.12.2
SecretStorage==3.3.1
six==1.16.0
smmap==5.0.1
snowflake-connector-python==3.12.3
sortedcontainers==2.4.0
sqlparse==0.5.0
ssh-import-id==5.11
stack-data==0.2.0
statsmodels==0.14.0
tenacity==8.2.2
threadpoolctl==2.2.0
thrift==0.20.0
tokenize-rt==4.2.1
tomli==2.1.0
tomlkit==0.13.2
tornado==6.3.2
traitlets==5.7.1
types-pytz==2024.2.0.20241003
typing_extensions==4.12.2
tzdata==2022.1
ujson==5.4.0
unattended-upgrades==0.1
urllib3==1.26.16
virtualenv==20.24.2
wadllib==1.3.6
wcwidth==0.2.5
zipp==3.11.0
What did you do?
Try to just perform import of connector `from snowflake import connector as snowflake_connector`, this will trigger the resolution of DIRS from `snowflake.connector.constants`.

And I'm facing the error: 

  File "/local_disk0/.ephemeral_nfs/cluster_libraries/python/lib/python3.11/site-packages/snowflake/connector/sf_dirs.py", line 37, in _resolve_platform_dirs
    if snowflake_home.exists():
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/pathlib.py", line 1236, in exists
    self.stat()
  File "/usr/lib/python3.11/pathlib.py", line 1014, in stat
    return os.stat(self, follow_symlinks=follow_symlinks)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/root/.snowflake'
What did you expect to see?

Correct handling of denied access to root folder

Can you set logging to DEBUG and collect the logs?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in snowflake/connector/sf_dirs.py at _resolve_platform_dirs, reached during import through snowflake.connector.constants, and reproduce the import with /root/.snowflake inaccessible. Trace how the pathlib existence check handles the PermissionError. Done means importing the connector succeeds and denied access to the root folder is handled as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
database
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.