Auto-Index
Let Synnax generate timestamps for you when writing data.
By default, every write to a data channel must include a matching series of timestamps
for that channel’s index. When auto_index
How It Works
When auto_index
True
- For each index channel in the writer that you didn’t include in the write, Synnax generates a timestamp series with one timestamp per sample.
- Timestamps are produced server-side by the Core that owns the index channel, so they reflect the Core’s wall clock — not the client’s.
- The first sample is stamped at the moment the Core processes the write. Subsequent samples in the same write are spaced 1 nanosecond apart.
- Auto-generated timestamps are strictly monotonic across consecutive auto-stamped writes on the same writer.
If you open the writer with a data channel but don’t include its index channel, Synnax adds the index channel to the writer for you so it can stamp the data.
Writing Without an Index Channel
The simplest case is opening a writer with only a data channel and letting Synnax stamp
every sample. The Python client requires a start argument, but it’s just a placeholder
when auto-index is on — pass start=0 and Synnax will supply the real timestamps. The
TypeScript client makes start optional.
with client.open_writer(
start=0,
channels=["temperature"],
auto_index=True,
) as writer:
for i in range(100):
writer.write({"temperature": i * 0.1})
sy.sleep(0.1)
writer.commit() const writer = await client.openWriter({
channels: ["temperature"],
autoIndex: true,
});
try {
for (let i = 0; i < 100; i++) await writer.write("temperature", i * 0.1);
await writer.commit();
} finally {
await writer.close();
} Mixing Generated and User-Provided Timestamps
You can open a writer with both index and data channels and choose, per write call, whether to provide your own timestamps or let Synnax generate them. Any write that omits the index channel is auto-stamped; any write that includes the index channel uses the timestamps you supplied.
with client.open_writer(
start=sy.TimeStamp.now(),
channels=["time", "temperature"],
auto_index=True,
) as writer:
# User-provided timestamps for this write.
writer.write({
"time": sy.TimeStamp.now(),
"temperature": 21.5,
})
# Synnax generates the timestamp for this write.
writer.write({"temperature": 21.6})
writer.commit() const writer = await client.openWriter({
start: TimeStamp.now(),
channels: ["time", "temperature"],
autoIndex: true,
});
try {
// User-provided timestamps for this write.
await writer.write({ time: TimeStamp.now(), temperature: 21.5 });
// Synnax generates the timestamp for this write.
await writer.write("temperature", 21.6);
await writer.commit();
} finally {
await writer.close();
} When to Use Auto-Index
Auto-index is a good fit when:
- You’re recording data where the exact sample time isn’t critical — log lines, status values, event-style data.
- You want a simpler write path and don’t want to manage timestamps yourself.
- You’re prototyping and don’t yet have a clear story for sample timing.
Auto-index is not a good fit when:
- You need timestamps that reflect the actual moment a sample was taken at the source (e.g., a sensor with its own clock). Generated timestamps reflect arrival time, not acquisition time.
- You need a known sample rate. Auto-generated samples are spaced 1 nanosecond apart within a single write call, which doesn’t represent any real sample rate.
- You’re writing historical data with a meaningful time range — supply explicit timestamps instead.
Auto-generated timestamps reflect when Synnax received the write, not when the data was originally acquired. If preserving acquisition time matters for your use case, write timestamps explicitly.