pudo / dataset

Easy-to-use data handling for SQL data stores with support for implicit table creation, bulk loading, and transactions.
https://dataset.readthedocs.org/
MIT License
4.78k stars 298 forks source link

Update util.py - fix ensure_tuple instance check #257

Closed mmajewsk closed 6 years ago

mmajewsk commented 6 years ago

doing isinstance(obj, Sequence) makes calls with keys of dict impossible Example:

d = {'a':'a', 'b':'b'}
table.upsert(values, d.keys())

d.keys() is of type dict_keys(['a', 'b']) and is not of instance Sequence, but Iterable, therefore ensure_tuple(dict_keys(['a', 'b'])) returns (dict_keys(['a', 'b']),) which leads to invalid iteration.