@@ -104,7 +104,7 @@ cnp.import_array()
104104#  This value is automatically updated by the `bump2version` tool.
105105#  If you need to update it, also update the search definition in
106106#  .bumpversion.cfg.
107- VERSION =  ' 3 .0.0' 
107+ VERSION =  ' 4 .0.0' 
108108
109109WARN_HIGH_RECONNECTS =  True 
110110
@@ -648,7 +648,7 @@ cdef class SenderTransaction:
648648            symbols: Optional[Dict[str , Optional[str]]]=None ,
649649            columns: Optional[Dict[
650650                str ,
651-                 Union[None , bool , int , float , str , TimestampMicros , datetime.datetime , numpy.ndarray]]
651+                 Union[None , bool , int , float , str , TimestampMicros , TimestampNanos ,  datetime.datetime , numpy.ndarray]]
652652                ]=None ,
653653            at: Union[ServerTimestampType , TimestampNanos , datetime.datetime]):
654654        """ 
@@ -962,12 +962,18 @@ cdef class Buffer:
962962        if  not  line_sender_buffer_column_str(self ._impl, c_name, c_value, & err):
963963            raise  c_err_to_py(err)
964964
965-     cdef inline void_int _column_ts (
965+     cdef inline void_int _column_ts_micros (
966966            self , line_sender_column_name c_name, TimestampMicros ts) except  - 1 :
967967        cdef line_sender_error*  err =  NULL 
968968        if  not  line_sender_buffer_column_ts_micros(self ._impl, c_name, ts._value, & err):
969969            raise  c_err_to_py(err)
970970
971+     cdef inline void_int _column_ts_nanos(
972+             self , line_sender_column_name c_name, TimestampNanos ts) except  - 1 :
973+         cdef line_sender_error*  err =  NULL 
974+         if  not  line_sender_buffer_column_ts_nanos(self ._impl, c_name, ts._value, & err):
975+             raise  c_err_to_py(err)
976+ 
971977    cdef inline void_int _column_numpy(
972978            self , line_sender_column_name c_name, cnp.ndarray arr) except  - 1 :
973979        if  cnp.PyArray_TYPE(arr) !=  cnp.NPY_FLOAT64:
@@ -1004,6 +1010,8 @@ cdef class Buffer:
10041010    cdef inline void_int _column_dt(
10051011            self , line_sender_column_name c_name, cp_datetime dt) except  - 1 :
10061012        cdef line_sender_error*  err =  NULL 
1013+         #  We limit ourselves to micros, since this is the maxium precision
1014+         #  exposed by the datetime library in Python.
10071015        if  not  line_sender_buffer_column_ts_micros(
10081016                self ._impl, c_name, datetime_to_micros(dt), & err):
10091017            raise  c_err_to_py(err)
@@ -1020,7 +1028,9 @@ cdef class Buffer:
10201028        elif  PyUnicode_CheckExact(< PyObject* > value):
10211029            self ._column_str(c_name, value)
10221030        elif  isinstance (value, TimestampMicros):
1023-             self ._column_ts(c_name, value)
1031+             self ._column_ts_micros(c_name, value)
1032+         elif  isinstance (value, TimestampNanos):
1033+             self ._column_ts_nanos(c_name, value)
10241034        elif  PyArray_CheckExact(< PyObject * >  value):
10251035            self ._column_numpy(c_name, value)
10261036        elif  isinstance (value, cp_datetime):
@@ -1045,15 +1055,20 @@ cdef class Buffer:
10451055            if  sender !=  NULL :
10461056                may_flush_on_row_complete(self , < Sender>< object > sender)
10471057
1048-     cdef inline void_int _at_ts(self , TimestampNanos ts) except  - 1 :
1058+     cdef inline void_int _at_ts_us(self , TimestampMicros ts) except  - 1 :
1059+         cdef line_sender_error*  err =  NULL 
1060+         if  not  line_sender_buffer_at_micros(self ._impl, ts._value, & err):
1061+             raise  c_err_to_py(err)
1062+ 
1063+     cdef inline void_int _at_ts_ns(self , TimestampNanos ts) except  - 1 :
10491064        cdef line_sender_error*  err =  NULL 
10501065        if  not  line_sender_buffer_at_nanos(self ._impl, ts._value, & err):
10511066            raise  c_err_to_py(err)
10521067
10531068    cdef inline void_int _at_dt(self , cp_datetime dt) except  - 1 :
1054-         cdef int64_t value =  datetime_to_nanos (dt)
1069+         cdef int64_t value =  datetime_to_micros (dt)
10551070        cdef line_sender_error*  err =  NULL 
1056-         if  not  line_sender_buffer_at_nanos (self ._impl, value, & err):
1071+         if  not  line_sender_buffer_at_micros (self ._impl, value, & err):
10571072            raise  c_err_to_py(err)
10581073
10591074    cdef inline void_int _at_now(self ) except  - 1 :
@@ -1064,8 +1079,10 @@ cdef class Buffer:
10641079    cdef inline void_int _at(self , object  ts) except  - 1 :
10651080        if  ts is  None :
10661081            self ._at_now()
1082+         elif  isinstance (ts, TimestampMicros):
1083+             self ._at_ts_us(ts)
10671084        elif  isinstance (ts, TimestampNanos):
1068-             self ._at_ts (ts)
1085+             self ._at_ts_ns (ts)
10691086        elif  isinstance (ts, cp_datetime):
10701087            self ._at_dt(ts)
10711088        else :
@@ -1115,7 +1132,7 @@ cdef class Buffer:
11151132            symbols: Optional[Dict[str , Optional[str]]]=None ,
11161133            columns: Optional[Dict[
11171134                str ,
1118-                 Union[None , bool , int , float , str , TimestampMicros , datetime.datetime , numpy.ndarray]]
1135+                 Union[None , bool , int , float , str , TimestampMicros , TimestampNanos ,  datetime.datetime , numpy.ndarray]]
11191136                ]=None ,
11201137            at: Union[ServerTimestampType , TimestampNanos , datetime.datetime]):
11211138        """ 
0 commit comments