@@ -635,14 +635,11 @@ cdef class Buffer:
635
635
self._set_marker()
636
636
try:
637
637
self._table(table_name)
638
- if not (symbols or columns):
639
- raise IngressError(
640
- IngressErrorCode.InvalidApiCall,
641
- 'Must specify at least one symbol or column')
642
638
if symbols is not None:
643
639
for name, value in symbols.items():
644
- self._symbol(name, value)
645
- wrote_fields = True
640
+ if value is not None:
641
+ self._symbol(name, value)
642
+ wrote_fields = True
646
643
if columns is not None:
647
644
for name, value in columns.items():
648
645
if value is not None:
@@ -663,7 +660,7 @@ cdef class Buffer:
663
660
self,
664
661
table_name: str,
665
662
*,
666
- symbols: Optional[Dict[str, str]]=None,
663
+ symbols: Optional[Dict[str, Optional[ str] ]]=None,
667
664
columns: Optional[Dict[
668
665
str,
669
666
Union[None, bool, int, float, str, TimestampMicros, datetime]]
@@ -672,14 +669,12 @@ cdef class Buffer:
672
669
"""
673
670
Add a single row (line) to the buffer .
674
671
675
- At least one ``symbols`` or ``columns`` must be specified.
676
-
677
672
.. code- block:: python
678
673
679
674
# All fields specified.
680
675
buffer .row(
681
676
' table_name' ,
682
- symbols = {' sym1' : ' abc' , ' sym2' : ' def' },
677
+ symbols = {' sym1' : ' abc' , ' sym2' : ' def' , ' sym3 ' : None },
683
678
columns = {
684
679
' col1' : True ,
685
680
' col2' : 123 ,
@@ -741,12 +736,16 @@ cdef class Buffer:
741
736
742
737
:param table_name: The name of the table to which the row belongs.
743
738
:param symbols: A dictionary of symbol column names to ``str `` values.
739
+ As a convenience, you can also pass a ``None `` value which will
740
+ have the same effect as skipping the key: If the column already
741
+ existed, it will be recorded as ``NULL ``, otherwise it will not be
742
+ created.
744
743
:param columns: A dictionary of column names to ``bool ``, ``int ``,
745
744
``float ``, ``str ``, ``TimestampMicros`` or ``datetime`` values.
746
- As a convenience, you can also pass a ``None `` value, however - due
747
- to ILP protocol limitations - this will skip the column rather
748
- necessarily writing a ``NULL `` value, so if the column did not exist
749
- yet it will not be created.
745
+ As a convenience, you can also pass a ``None `` value which will
746
+ have the same effect as skipping the key: If the column already
747
+ existed, it will be recorded as ``NULL ``, otherwise it will not be
748
+ created.
750
749
:param at: The timestamp of the row. If ``None ``, timestamp is assigned
751
750
by the server. If ``datetime``, the timestamp is converted to
752
751
nanoseconds. A nanosecond unix epoch timestamp can be passed
0 commit comments