snowflake-connector-python icon indicating copy to clipboard operation
snowflake-connector-python copied to clipboard

SNOW-560024: Getting 'TypeError: '_is_internal' is an invalid keyword argument for this function' when trying to write a table

Open viktoria-ivan opened this issue 2 years ago • 4 comments

Please answer these questions before submitting your issue. Thanks!

  1. What version of Python are you using?

    Python 3.9.7

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

    macOS-12.1-x86_64-i386-64bit

  3. What are the component versions in the environment (pip freeze)?

    appnope==0.1.2 argon2-cffi==21.1.0 asn1crypto==1.5.0 astor==0.8.1 attrs==21.2.0 autograd==1.3 autograd-gamma==0.5.0 backcall==0.2.0 beautifulsoup4==4.10.0 black==21.9b0 bleach==4.1.0 cachetools==4.2.4 certifi==2021.10.8 cffi==1.15.0 chardet==3.0.4 charset-normalizer==2.0.7 click==8.0.1 cmdstanpy==0.9.68 colorama==0.4.1 convertdate==2.3.2 cryptography==36.0.1 cycler==0.10.0 Cython==0.29.24 dataclasses==0.6 dbi==1.2.5 deap==1.3.1 debugpy==1.5.1 decorator==5.1.0 deep-translator==1.5.4 defusedxml==0.7.1 dill==0.3.4 entrypoints==0.3 ephem==4.1 et-xmlfile==1.1.0 fastdtw==0.3.4 formulaic==0.2.4 future==0.18.2 google-api-core==2.1.1 google-auth==2.3.0 google-cloud-core==2.1.0 google-cloud-translate==3.6.0 google-trans-new==1.1.9 googleapis-common-protos==1.53.0 googletrans==4.0.0rc1 grpcio==1.41.0 h11==0.9.0 h2==3.2.0 hijri-converter==2.2.2 holidays==0.11.3.1 hpack==3.0.0 hstspreload==2021.10.1 httpcore==0.9.1 httpx==0.13.3 hyperframe==5.2.0 idna==2.10 iniconfig==1.1.1 interface-meta==1.2.4 ipykernel==6.5.0 ipython==7.29.0 ipython-genutils==0.2.0 ipywidgets==7.6.5 jedi==0.18.0 Jinja2==3.0.2 joblib==1.0.1 jsonschema==4.2.0 jupyter==1.0.0 jupyter-client==7.0.6 jupyter-console==6.4.0 jupyter-core==4.9.1 jupyterlab-pygments==0.1.2 jupyterlab-widgets==1.0.2 kiwisolver==1.3.2 korean-lunar-calendar==0.2.1 lifelines==0.26.4 LunarCalendar==0.0.9 MarkupSafe==2.0.1 matplotlib==3.4.3 matplotlib-inline==0.1.3 mistune==0.8.4 mock==4.0.3 multiprocess==0.70.12.2 mypy-extensions==0.4.3 nbclient==0.5.4 nbconvert==6.2.0 nbformat==5.1.3 nest-asyncio==1.5.1 neuralprophet==0.3.0 notebook==6.4.5 numpy==1.21.2 openpyxl==3.0.9 oscrypto==1.2.1 packaging==21.0 pandas==1.3.3 pandocfilters==1.5.0 parso==0.8.2 pathspec==0.9.0 patsy==0.5.2 pexpect==4.8.0 pickleshare==0.7.5 Pillow==8.3.2 platformdirs==2.4.0 plotly==5.6.0 pluggy==1.0.0 prometheus-client==0.12.0 prompt-toolkit==3.0.22 prophet==1.0.1 proto-plus==1.19.5 protobuf==3.19.0 psycopg2==2.9.1 ptyprocess==0.7.0 py==1.11.0 pyarrow==6.0.1 pyasn1==0.4.8 pyasn1-modules==0.2.8 pycparser==2.20 pycryptodomex==3.14.1 Pygments==2.10.0 PyJWT==2.3.0 PyMeeus==0.5.11 pyOpenSSL==21.0.0 pyparsing==2.4.7 pyrsistent==0.18.0 pystan==2.19.1.1 pytest==6.2.5 python-dateutil==2.8.2 pytz==2021.1 pyxlsb==1.0.9 pyzmq==22.3.0 qtconsole==5.1.1 QtPy==1.11.2 regex==2021.9.30 requests==2.26.0 rfc3986==1.5.0 rsa==4.7.2 scikit-learn==1.0 scipy==1.7.1 seaborn==0.11.2 Send2Trash==1.8.0 setuptools-git==1.2 six==1.16.0 sklearn==0.0 sklearn-genetic==0.5.1 sniffio==1.2.0 snowflake-connector-python==2.7.4 soupsieve==2.3 sqlparse==0.4.2 statsmodels==0.12.2 temp==2020.7.2 tenacity==8.0.1 terminado==0.12.1 testpath==0.5.0 threadpoolctl==3.0.0 toml==0.10.2 tomli==1.2.1 torch==1.10.1 torch-lr-finder==0.2.1 tornado==6.1 tqdm==4.62.3 traitlets==5.1.1 typing-extensions==3.10.0.2 ujson==4.2.0 urllib3==1.26.7 wcwidth==0.2.5 webencodings==0.5.1 widgetsnbextension==3.5.2 wrapt==1.13.3 xlrd==2.0.1

  4. What did you do?

I'm trying to write a table to snowflake with: ` from snowflake.connector.pandas_tools import write_pandas from snowflake.connector import connect

write_pandas( conn=conn, df=f, database=database, schema=schema, table_name=table_name ) `

  1. What did you expect to see?

I expected this to succeed and the table to be written in snowflake but instead I keep getting this error:

Screenshot 2022-03-15 at 15 09 56
  1. Can you set logging to DEBUG and collect the logs?

    import logging
    import os
    
    for logger_name in ['snowflake.sqlalchemy', 'snowflake.connector', 'botocore']:
        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)
    

viktoria-ivan avatar Mar 15 '22 15:03 viktoria-ivan

On version 2.7.4 execute definitely has that argument. Are you by any chance overwriting the default cursor implementation, or supplying your own implementation?

sfc-gh-mkeller avatar Mar 21 '22 17:03 sfc-gh-mkeller

No, not that I'm aware of. I thought it might that I had an old version installed but I uninstalled and then re-installed again and I'm still getting the same error. Are there any dependencies I should upgrade to the right version?

viktoria-ivan avatar Mar 21 '22 17:03 viktoria-ivan

Are there any dependencies I should upgrade to the right version? pyarrow is the only one that's tightly coupled with our releases, but it looks like you already have the right version installed.

Could you please share a small reproduction script?

sfc-gh-mkeller avatar Mar 21 '22 17:03 sfc-gh-mkeller

Check if you don't have multiple connections with different packages but with the same variable name ie snowflake connector and psycopg2 connector both called conn

CainDelta avatar Sep 09 '22 17:09 CainDelta

To clean up and re-prioritize bugs and feature requests we are closing all issues older than 6 months as of March 1, 2023. If there are any issues or feature requests that you would like us to address, please re-create them. For urgent issues, opening a support case with this link Snowflake Community is the fastest way to get a response.

sfc-gh-aling avatar Mar 20 '23 17:03 sfc-gh-aling