api: allow local update if series exists locally and remotely
2 files changed, 15 insertions(+), 14 deletions(-)

M test/test_api.py
M tshistory/api.py
M test/test_api.py +8 -9
@@ 641,12 641,11 @@ def test_conflicting_update(mapi):
         'Babar'
     )
 
-    with pytest.raises(ValueError) as err:
-        mapi.update(
-            'here-and-there',
-            pd.Series(
-                [1, 2, 3, 4],
-                index=pd.date_range(utcdt(2020, 1, 1), periods=4, freq='D')
-            ),
-            'Babar'
-        )
+    mapi.update(
+        'here-and-there',
+        pd.Series(
+            [1, 2, 3, 4],
+            index=pd.date_range(utcdt(2020, 1, 1), periods=4, freq='D')
+        ),
+        'Babar'
+    )

          
M tshistory/api.py +7 -5
@@ 101,11 101,13 @@ class dbtimeseries:
 
         """
 
-        # give a chance to say *no*
-        self.othersources.forbidden(
-            name,
-            'not allowed to update to a secondary source'
-        )
+        # check local existence
+        if not self.tsh.exists(self.engine, name):
+            # give a chance to say *no*
+            self.othersources.forbidden(
+                name,
+                'not allowed to update to a secondary source'
+            )
 
         return self.tsh.update(
             self.engine,