Q:

ImportError: cannot import name 'PY2'

Want to use SQLalchemy to connect to snowflake. Getting the following error while creating engine for snowflake:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sqlalchemy\engine\__init__.py", line 479, in create_engine
    return strategy.create(*args, **kwargs)
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sqlalchemy\engine\strategies.py", line 61, in create
    entrypoint = u._get_entrypoint()
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sqlalchemy\engine\url.py", line 172, in _get_entrypoint
    cls = registry.load(name)
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\sqlalchemy\util\langhelpers.py", line 222, in load
    return self.impls[name]()
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 2443, in load
    return self.resolve()
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pkg_resources\__init__.py", line 2449, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\snowflake\sqlalchemy\__init__.py", line 12, in <module>
    from .util import _url as URL
  File "C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\snowflake\sqlalchemy\util.py", line 9, in <module>
    from snowflake.connector.compat import (PY2, IS_STR)
ImportError: cannot import name 'PY2' from 'snowflake.connector.compat' (C:\Users\mithi\AppData\Local\Programs\Python\Python38-32\lib\site-packages\snowflake\connector\compat.py)

Engine creation code is this:
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL
create_engine(URL("snowflake", username="***",password="***",host="***"))

A:

I matched all dependencies at tested requirements page. Issue was resolved for me with pip install --upgrade snowflake-sqlalchemy. I'm running Python 3.7.6 with version 2.2.1 of snowflake-connector-python

