databricks-sql-cli icon indicating copy to clipboard operation
databricks-sql-cli copied to clipboard

ImportError For Python Versions > 3.9

Open mawi510 opened this issue 1 year ago • 0 comments

I'm using Python 3.11 and I got an ImportError when I tried to run dbsqlcli after setting up my dbsqlclirc file

The exact error was

 File "/Users/dfasil/.pyenv/versions/3.11.10/lib/python3.11/site-packages/databricks/sql/utils.py", line 1, in <module>
    from collections import namedtuple, OrderedDict, Iterable
ImportError: cannot import name 'Iterable' from 'collections' (/Users/dfasil/.pyenv/versions/3.11.10/lib/python3.11/collections/__init__.py)

As noted where it says Deprecated, Iterable was moved to collections.abc for Python versions > 3.9, thus why I was seeing the error

So in my local file I changed the following and now I'm up and running:

-from collections import namedtuple, OrderedDict, Iterable

+from collections import namedtuple, OrderedDict
+from collections.abc import Iterable

Wanted to flag this in case others saw this issue/if this is something that can be accounted for in a future version. Thank you!

mawi510 avatar Nov 01 '24 19:11 mawi510