From 1c1da8b17bdf0e7e881e15bb731119558bd5440f Mon Sep 17 00:00:00 2001 From: Multazim Deshmukh <57723564+mdeshmu@users.noreply.github.com> Date: Wed, 17 May 2023 20:49:50 +0530 Subject: [PATCH] Correcting Iterable import for python 3.10 (#451) --- pyhive/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pyhive/common.py b/pyhive/common.py index 298633a1..51692b97 100644 --- a/pyhive/common.py +++ b/pyhive/common.py @@ -18,6 +18,11 @@ from future.utils import with_metaclass from itertools import islice +try: + from collections.abc import Iterable +except ImportError: + from collections import Iterable + class DBAPICursor(with_metaclass(abc.ABCMeta, object)): """Base class for some common DB-API logic""" @@ -245,7 +250,7 @@ def escape_item(self, item): return self.escape_number(item) elif isinstance(item, basestring): return self.escape_string(item) - elif isinstance(item, collections.Iterable): + elif isinstance(item, Iterable): return self.escape_sequence(item) elif isinstance(item, datetime.datetime): return self.escape_datetime(item, self._DATETIME_FORMAT)