Please answer these questions before submitting your issue. Thanks!
- What version of Python are you using (
python --version)?
3.8.11
- What operating system and processor architecture are you using (
python -c 'import platform; print(platform.platform())')?
macOS-10.16-x86_64-i386-64bit
- What are the component versions in the environment (
pip list)?
I'm using an anaconda environment.
snowflake-connector-python 2.7.2 py38h27c1234_0 conda-forge
snowflake-sqlalchemy 1.3.3 pyhd8ed1ab_0 conda-forge
sqlalchemy 1.4.23 pypi_0 pypi
- What did you do?
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
I tried to run a simple read_query using a Pandas query with session parameters included. The error is simply a parsing error so I have filled the session parameter with a dummy value.
import os
username = os.environ["SF_USER"]
password = os.environ["SF_PASSWORD"]
account = "my_snowflake_account"
db = "SNOWFLAKE_SAMPLE_DATA"
schema = "TPCH_SF1"
connection_params = {
"warehouse": "DEMO_WH",
# Here is the issue
"session_parameters": json.dumps({"DUMMY": 0}),
"paramstyle": "pyformat",
"insecure_mode": True,
}
conn = f"snowflake://{username}:{password}@{account}/{db}/{schema}?{urllib.parse.urlencode(connection_params)}"
query = "SELECT * FROM LINEITEM ORDER BY L_ORDERKEY, L_PARTKEY, L_SUPPKEY LIMIT 70"
df = pd.read_sql(query, conn)
print(df)
- What did you expect to see?
The table should be successfully loaded without any issues.
- What did you see instead?
An internal error inside the snowflake connector.
if self._autocommit is not None:
> self._session_parameters[PARAMETER_AUTOCOMMIT] = self._autocommit
E TypeError: 'str' object does not support item assignment
Earlier in this file the snowflake connector states that this parameter should either be a dictionary or None. I believe this parameter needs to be converted from a json string back to a dictionary before the Snowflake connection is created.
Please answer these questions before submitting your issue. Thanks!
python --version)?3.8.11
python -c 'import platform; print(platform.platform())')?macOS-10.16-x86_64-i386-64bit
pip list)?I'm using an anaconda environment.
snowflake-connector-python 2.7.2 py38h27c1234_0 conda-forge
snowflake-sqlalchemy 1.3.3 pyhd8ed1ab_0 conda-forge
sqlalchemy 1.4.23 pypi_0 pypi
If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
I tried to run a simple
read_queryusing a Pandas query with session parameters included. The error is simply a parsing error so I have filled the session parameter with a dummy value.The table should be successfully loaded without any issues.
An internal error inside the snowflake connector.
Earlier in this file the snowflake connector states that this parameter should either be a dictionary or None. I believe this parameter needs to be converted from a json string back to a dictionary before the Snowflake connection is created.