← All tasks
pythonsnowflakedb/snowflake-connector-python #892Not a task: not reproduced

SNOW-475323: write_pandas throwing __init__() missing 1 required positional argument: 'backend'

envgap__snowflakedb__snowflake-connector-python-892

01 / FAILURE SIGNATURE

As reported upstream

TypeError: __init__() missing 1 required positional argument: 'backend'
Not a benchmark task.
  • In a clean container the reported failure did not reproduce, or the known fix did not make the project run.

02 / ENVIRONMENT RECIPE

Base commit
7e8aa42b54b5efe46e82d1f281c0df6b6348c5e5
Manifest
setup.py
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

snowflakedb/snowflake-connector-python #892 · read the original issue
1. What version of Python are you using?



```

Python 3.9.7 (default, Sep 22 2021, 11:29:53)

[Clang 12.0.5 (clang-1205.0.22.11)]

```



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



```

macOS-11.6-x86_64-i386-64bit

```

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



```

anyio==3.3.2

appnope==0.1.2

argon2-cffi==21.1.0

asn1crypto==1.4.0

attrs==21.2.0

azure-common==1.1.27

azure-core==1.19.0

azure-storage-blob==12.9.0

azure-storage-common==2.1.0

Babel==2.9.1

backcall==0.2.0

bleach==4.1.0

boto3==1.18.54

botocore==1.21.56

certifi==2020.12.5

cffi==1.13.2

chardet==3.0.4

charset-normalizer==2.0.6

cryptography==2.8

debugpy==1.5.0

decorator==5.1.0

defusedxml==0.7.1

docutils==0.15.2

dominate==2.6.0

entrypoints==0.3

Faker==8.16.0

future==0.18.2

idna==2.8

ijson==2.6.1

ipykernel==6.4.1

ipython==7.28.0

ipython-genutils==0.2.0

ipywidgets==7.6.5

isodate==0.6.0

jedi==0.18.0

Jinja2==3.0.2

jmespath==0.10.0

json5==0.9.6

jsonlines==2.0.0

jsonschema==4.0.1

jupyter==1.0.0

jupyter-client==7.0.6

jupyter-console==6.4.0

jupyter-core==4.8.1

jupyter-server==1.11.1

jupyterlab==3.1.17

jupyterlab-pygments==0.1.2

jupyterlab-server==2.8.2

jupyterlab-widgets==1.0.2

MarkupSafe==2.0.1

matplotlib-inline==0.1.3

mistune==0.8.4

msrest==0.6.21

nbclassic==0.3.2

nbclient==0.5.4

nbconvert==6.2.0

nbformat==5.1.3

nest-asyncio==1.5.1

notebook==6.4.4

numpy==1.21.2

oauthlib==3.1.1

oscrypto==1.2.1

packaging==21.0

pandas==1.3.3

pandocfilters==1.5.0

parso==0.8.2

pexpect==4.8.0

pickleshare==0.7.5

prometheus-client==0.11.0

prompt-toolkit==3.0.20

ptyprocess==0.7.0

pyarrow==5.0.0

pycparser==2.20

pycryptodomex==3.10.4

pydantic==1.8.2

Pygments==2.10.0

PyJWT==1.7.1

pyOpenSSL==19.1.0

pyparsing==2.4.7

pyrsistent==0.18.0

python-dateutil==2.8.2

python-dotenv==0.19.0

pytz==2020.5

pyzmq==22.3.0

qtconsole==5.1.1

QtPy==1.11.2

requests==2.22.0

requests-oauthlib==1.3.0

requests-unixsocket==0.2.0

s3transfer==0.5.0

Send2Trash==1.8.0

six==1.16.0

sniffio==1.2.0

snowflake-connector-python==2.6.2

terminado==0.12.1

testpath==0.5.0

text-unidecode==1.3

tornado==6.1

traitlets==5.1.0

typing-extensions==3.10.0.2

urllib3==1.25.11

wcwidth==0.2.5

webencodings==0.5.1

websocket-client==1.2.1

widgetsnbextension==3.5.1

```



4. What did you do?



I simply created a dataframe and attempted to write it to a table and this error occurred.



5. What did you expect to see?



Expected it to write the df to snowflake.



I was able to fix it by upgrading cryptography==3.4.8. 

I'm not sure if this is a general issue with cryptography or my environment though.





<details>

<summary>Stack Trace</summary>



```



TypeError                                 Traceback (most recent call last)

     34     def insert_df(self, df: DataFrame, table: str):

---> 35         return sfp.write_pandas(self.conn, df, table)



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/pandas_tools.py in write_pandas(conn, df, table_name, database, schema, chunk_size, compression, on_error, parallel, quote_identifiers)

    171             )

    172             logger.debug("uploading files with '{}'".format(upload_sql))

--> 173             cursor.execute(upload_sql, _is_internal=True)

    174             # Remove chunk file

    175             os.remove(chunk_path)



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/cursor.py in execute(self, command, params, _bind_stage, timeout, _exec_async, _do_reset, _put_callback, _put_azure_callback, _put_callback_output_stream, _get_callback, _get_azure_callback, _get_callback_output_stream, _show_progress_bar, _statement_params, _is_internal, _describe_only, _no_results, _use_ijson, _is_put_get, _raise_put_get_error, _force_put_overwrite, file_stream)

    740                     use_s3_regional_url=self._connection.enable_stage_s3_privatelink_for_us_east_1,

    741                 )

--> 742                 sf_file_transfer_agent.execute()

    743                 data = sf_file_transfer_agent.result()

    744                 self._total_rowcount = len(data["rowset"]) if "rowset" in data else -1



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/file_transfer_agent.py in execute(self)

    377             m.self = self

    378 

--> 379         self._transfer_accelerate_config()

    380 

    381         if self._command_type == CMD_TYPE_DOWNLOAD:



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/file_transfer_agent.py in _transfer_accelerate_config(self)

    669         if self._stage_location_type == S3_FS:

    670             client = self._create_file_transfer_client(self._file_metadata[0])

--> 671             self._use_accelerate_endpoint = client.transfer_accelerate_config()

    672 

    673     def result(self):



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/s3_storage_client.py in transfer_accelerate_config(self)

    546         retry_id = "accelerate"

    547         self.retry_count[retry_id] = 0

--> 548         response = self._send_request_with_authentication_and_retry(

    549             url=url, verb="GET", retry_id=retry_id, query_parts=dict(query_parts)

    550         )



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/s3_storage_client.py in _send_request_with_authentication_and_retry(self, url, verb, retry_id, query_parts, x_amz_headers, headers, payload, unsigned_payload)

    288         else:

    289             x_amz_headers["x-amz-content-sha256"] = (

--> 290                 SnowflakeS3RestClient._hash_bytes_hex(payload).lower().decode()

    291             )

    292 



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/s3_storage_client.py in _hash_bytes_hex(_input)

    124     def _hash_bytes_hex(_input: bytes) -> bytes:

    125         """Convenience function, same as _hash_bytes, but returns result in hex form."""

--> 126         return binascii.hexlify(SnowflakeS3RestClient._hash_bytes(_input))

    127 

    128     @staticmethod



~/.pyenv/versions/3.9.7/envs/ex/lib/python3.9/site-packages/snowflake/connector/s3_storage_client.py in _hash_bytes(_input)

    117     def _hash_bytes(_input: bytes) -> bytes:

    118         """Applies SHA-256 hash to given bytes."""

--> 119         digest = hashes.Hash(hashes.SHA256())

    120         digest.update(_input)

    121         return digest.finalize()



TypeError: __init__() missing 1 required positional argument: 'backend'



```



</details>



Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]