snowflakedb / snowflake-connector-python

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

SNOW-744534: prepare() gets args, but supports only kwargs #1439

Closed emilhe closed 1 year ago

emilhe commented 1 year ago

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

3.8.10

  1. What operating system and processor architecture are you using?

Linux-5.15.79.1-microsoft-standard-WSL2-x86_64-with-glibc2.29

  1. What are the component versions in the environment (pip freeze)?
adal==1.2.7
adlfs==2022.10.0
aiohttp==3.8.3
aiosignal==1.2.0
anyio==3.6.2
asn1crypto==1.5.1
async-generator==1.10
async-timeout==4.0.2
attrs==22.1.0
azure-common==1.1.28
azure-core==1.26.1
azure-datalake-store==0.0.52
azure-identity==1.11.0
azure-keyvault-secrets==4.6.0
azure-servicebus==7.8.1
azure-storage-blob==12.14.1
backoff==1.11.1
backports.zoneinfo==0.2.1
bcrypt==4.0.1
beautifulsoup4==4.11.2
black==23.1.0
cachelib==0.9.0
certifi==2022.9.24
cffi==1.15.1
charset-normalizer==2.1.1
click==8.1.3
cloudpickle==2.0.0
contourpy==1.0.6
coverage==6.5.0
cryptography==38.0.3
cycler==0.11.0
dash==2.8.1
dash-core-components==2.0.0
dash-down==0.1.1
dash-extensions==0.1.11
dash-html-components==2.0.0
dash-iconify==0.1.2
dash-mantine-components==0.11.1
dash-table==5.0.0
Deprecated==1.2.13
dill==0.3.6
EditorConfig==0.12.3
energyquantified==0.9.1
et-xmlfile==1.1.0
exceptiongroup==1.1.0
execnet==1.9.0
fastapi==0.87.0
filelock==3.9.0
Flask==2.2.2
Flask-Caching==2.0.1
Flask-WTF==1.0.1
fonttools==4.38.0
frozenlist==1.3.1
fsspec==2022.10.0
glob2==0.7
gunicorn==20.1.0
h11==0.14.0
idna==3.4
importlib-metadata==4.13.0
iniconfig==1.1.1
isodate==0.6.1
itsdangerous==2.1.2
Jinja2==3.1.2
jsbeautifier==1.14.7
jsonformatter==0.3.2
kiwisolver==1.4.4
lxml==4.9.2
Mako==1.2.3
MarkupSafe==2.1.1
matplotlib==3.6.2
mistune==2.0.4
more-itertools==8.14.0
msal==1.20.0
msal-extensions==1.0.0
msrest==0.7.1
multidict==6.0.2
multiprocess==0.70.14
mypy==0.982
mypy-extensions==0.4.3
numpy==1.23.4
oauthlib==3.2.2
openpyxl==3.0.10
oscrypto==1.3.0
outcome==1.2.0
packaging==23.0
pandas==1.5.1
paramiko==2.11.0
parse==1.19.0
parse-type==0.6.0
pathspec==0.10.1
percy==2.0.2
Pillow==9.3.0
platformdirs==2.5.3
plotly==5.11.0
pluggy==1.0.0
portalocker==2.6.0
prometheus-client==0.15.0
psutil==5.9.4
py==1.11.0
pyarrow==10.0.1
pycparser==2.21
pycryptodomex==3.17
pydantic==1.10.2
PyJWT==2.6.0
pylic==3.2.0
PyNaCl==1.5.0
pyOpenSSL==23.0.0
pyparsing==3.0.9
pysftp==0.2.9
PySocks==1.7.1
pytest==6.2.5
pytest-bdd==4.1.0
pytest-cov==2.12.1
pytest-forked==1.4.0
pytest-parallel==0.1.1
pytest-xdist==2.5.0
python-box==6.1.0
python-dateutil==2.8.2
python-dotenv==0.20.0
pytz==2022.6
pytz-deprecation-shim==0.1.0.post0
redis==4.3.4
requests==2.28.1
requests-oauthlib==1.3.1
selenium==4.2.0
setuptools-scm==7.0.5
six==1.16.0
sniffio==1.3.0
snowflake-connector-python==3.0.0
snowflake-snowpark-python==1.1.0
sortedcontainers==2.4.0
soupsieve==2.3.2.post1
starlette==0.21.0
tblib==1.7.0
tenacity==8.1.0
toml==0.10.2
tomli==2.0.1
trio==0.22.0
trio-websocket==0.9.2
types-cryptography==3.3.23.1
types-paramiko==2.11.0
types-redis==4.3.4
types-requests==2.28.11.5
types-urllib3==1.26.25.4
typing_extensions==4.4.0
tzdata==2022.7
tzlocal==4.2
uamqp==1.6.3
urllib3==1.26.12
urllib3-secure-extra==0.1.0
uvicorn==0.20.0
vestas-azure==0.1.16
vestas-dash-components==0.0.1
-e git+ssh://ssh.dev.azure.com/v3/vestas/PowerBrain/vestas-ems@4bf0fcaf665c38138e0c2ca2c34bef91fab7413d#egg=vestas_ems
vestas-powerforecast-client==1.0.0
waitress==2.1.2
Werkzeug==2.2.2
wrapt==1.14.1
wsproto==1.2.0
WTForms==3.0.1
yarl==1.8.1
zipp==3.10.0
  1. What did you do?

    Instantiate a session using private key auth. I get an error,

   Traceback (most recent call last):
  File "/home/emher/PycharmProjects/zpoc_ems_system/src/vestas_ems/common.py", line 86, in wrapper_func
    f(*args, **kwargs)
  File "/home/emher/PycharmProjects/zpoc_ems_system/src/vestas_ems/agent/energidataservice.py", line 116, in _run
    session = _get_snowpark_session(settings)
  File "/home/emher/PycharmProjects/zpoc_ems_system/src/vestas_ems/agent/energidataservice.py", line 44, in _get_snowpark_session
    return Session.builder.configs(connection_parameters).create()
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/snowpark/session.py", line 232, in create
    return self._create_internal(conn=None)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/snowpark/session.py", line 238, in _create_internal
    ServerConnection({}, conn) if conn else ServerConnection(self._options)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/snowpark/_internal/server_connection.py", line 138, in __init__
    self._conn = conn if conn else connect(**self._lower_case_parameters)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/__init__.py", line 51, in Connect
    return SnowflakeConnection(**kwargs)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/connection.py", line 302, in __init__
    self.connect(**kwargs)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/connection.py", line 566, in connect
    self.__open_connection()
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/connection.py", line 828, in __open_connection
    self.authenticate_with_retry(self.auth_class)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/connection.py", line 1084, in authenticate_with_retry
    self._authenticate(auth_instance)
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/connection.py", line 1127, in _authenticate
    auth_instance.handle_timeout(
  File "/home/emher/.cache/pypoetry/virtualenvs/vestas-ems-a8UVhBwn-py3.8/lib/python3.8/site-packages/snowflake/connector/auth/keypair.py", line 200, in handle_timeout
    self.prepare(account, user)
TypeError: prepare() takes 1 positional argument but 3 were given
  1. What did you expect to see?

    No error.

sfc-gh-aling commented 1 year ago

hi @emilhe , thanks for catching it! also appreciate the PR, it looks good and I've approved it.