Skip to content

ImportError For Python Versions > 3.9 #59

@mawi510

Description

@mawi510

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions