Skip to content

Commit 0b4d927

Browse files
author
Adrian Teng
committed
Remove restriction on column name
1 parent f5f6a78 commit 0b4d927

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

arctic/fixtures/arctic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def library(arctic, library_name):
7676

7777
@pytest.fixture(scope="function")
7878
def bitemporal_library(arctic, library_name):
79-
arctic.initialize_library(library_name, m.VERSION_STORE, segment='month') # TODO: segment=month??
79+
arctic.initialize_library(library_name, m.VERSION_STORE, segment='month')
8080
return BitemporalStore(arctic.get_library(library_name))
8181

8282

arctic/store/bitemporal_store.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ def update(self, symbol, data, metadata=None, upsert=True, as_of=None, **kwargs)
7878
as_of : `datetime.datetime`
7979
The "insert time". Default to datetime.now()
8080
"""
81-
if self.observe_column in data.index.names:
82-
raise ValueError("Column {} is not allowed as it is being used by bitemporal store interally.".format(self.observe_column))
8381
local_tz = mktz()
8482
if not as_of:
8583
as_of = dt.now()

tests/integration/store/test_bitemporal_store.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ def test_read_ts_raw(bitemporal_library):
4444
2012-11-08 17:06:11.040 | 2015-05-01 | 3.0""", num_index=2))
4545

4646

47+
def test_write_ts_with_column_name_same_as_observed_dt_ok(bitemporal_library):
48+
ts1 = read_str_as_pandas(""" sample_dt | observed_dt | near
49+
2012-09-08 17:06:11.040 | 2015-1-1 | 1.0
50+
2012-10-08 17:06:11.040 | 2015-1-1 | 2.0
51+
2012-10-09 17:06:11.040 | 2015-1-1 | 2.5
52+
2012-11-08 17:06:11.040 | 2015-1-1 | 3.0""")
53+
bitemporal_library.update('spam', ts1)
54+
assert_frame_equal(ts1, bitemporal_library.read('spam').data)
55+
56+
4757
def test_last_update(bitemporal_library):
4858
bitemporal_library.update('spam', ts1, as_of=dt(2015, 1, 1))
4959
bitemporal_library.update('spam', ts1, as_of=dt(2015, 1, 2))

tests/unit/store/test_bitemporal_store.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
from datetime import datetime as dt
22

3-
from mock import create_autospec, sentinel
3+
from mock import create_autospec
44
from pandas.util.testing import assert_frame_equal
5-
import pytest
65

76
from arctic.store.bitemporal_store import BitemporalStore
87
from tests.util import read_str_as_pandas
@@ -23,12 +22,3 @@ def test_add_observe_dt_index():
2322
2012-10-08 17:06:11.040 | 2001-01-01 | 2.0
2423
2012-10-09 17:06:11.040 | 2001-01-01 | 2.5
2524
2012-11-08 17:06:11.040 | 2001-01-01 | 3.0""", num_index=2))
26-
27-
28-
def test_update_with_observe_column_fails():
29-
self = create_autospec(BitemporalStore, observe_column='col_a')
30-
with pytest.raises(ValueError) as e:
31-
BitemporalStore.update(self, sentinel.symbol, read_str_as_pandas(
32-
"""col_b | col_a | near
33-
2012-09-08 17:06:11.040 | 2001-01-01 | 1.0""", num_index=2))
34-
assert str(e.value) == "Column col_a is not allowed as it is being used by bitemporal store interally."

0 commit comments

Comments
 (0)