Skip to content

Commit

Permalink
Merge pull request pandas-dev#141 from lyrickh/origin/allow_reading_o…
Browse files Browse the repository at this point in the history
…f_none

FSF-264 Allow reading of None values from arctic
  • Loading branch information
jamesblackburn committed May 20, 2016
2 parents d768410 + db0de3e commit 95087c5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# Coverage
htmlcov
.coverage
.idea
.cache
coverage.xml
junit.xml
/tmp/
4 changes: 2 additions & 2 deletions arctic/store/version_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ def get_info(self, symbol, as_of=None):


def _do_read(self, symbol, version, from_version=None, **kwargs):
if version.get('deleted'):
raise NoDataFoundException("No data found for %s in library %s" % (symbol, self._arctic_lib.get_name()))
handler = self._read_handler(version, symbol)
data = handler.read(self._arctic_lib, version, symbol, from_version=from_version, **kwargs)
if data is None:
raise NoDataFoundException("No data found for %s in library %s" % (symbol, self._arctic_lib.get_name()))
return VersionedItem(symbol=symbol, library=self._arctic_lib.get_name(), version=version['version'],
metadata=version.pop('metadata', None), data=data)
_do_read_retry = mongo_retry(_do_read)
Expand Down
5 changes: 5 additions & 0 deletions tests/integration/store/test_version_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ def test_delete_bson_versions(library):
assert coll.versions.count() == 0


def test_read_none_does_not_exception(library):
library.write(symbol, None)
assert library.read(symbol).data is None


def test_delete_item_has_symbol(library):
library.write(symbol, ts1)
library.write(symbol, ts2, prune_previous_version=False)
Expand Down

0 comments on commit 95087c5

Please sign in to comment.