Closed yuanbohan closed 8 months ago
I can do this, please assign to me.
I can do this, please assign to me.
BTW,if you want to talk to GreptimeDB members, you can reach us on Slack https://greptime.com/slack
Great! thank you.
Hi Greptime Team,
I try to writing UPDATE test case. I think just need using the key
to found row to update, but I found some thing strange.
My understand that key
in GreptimeDB is (table name,tags,timestamp)
, and value
is (fileds)
. So I just need use the key
to update rows.
But when I try to update data by key, I found the key
need contain other fileds, for example:
monitor := monitor{
ID: randomId(), // Tag Column
Host: "127.0.0.1", // Tag Column
Memory: 1, // Field Column
Cpu: 1.0, // Field Column
Temperature: -1, // Field Column
Ts: time1, // Timestamp
Running: true, // Field Column
}
...
table.AddTagColumn("id", types.INT64)
table.AddTagColumn("host", types.STRING)
table.AddFieldColumn("memory", types.UINT64)
table.AddFieldColumn("cpu", types.FLOAT64)
table.AddFieldColumn("temperature", types.INT64)
table.AddFieldColumn("running", types.BOOLEAN)
table.AddTimestampColumn("ts", types.TIMESTAMP_MILLISECOND)
err :=table.AddRow(monitor.ID, monitor.Host,monitor.Memory, monitor.Cpu, monitor.Temperature, monitor.Running,monitor.Ts)
...
updateTable.AddTagColumn("id", types.INT64)
updateTable.AddTagColumn("host", types.STRING)
updateTable.AddFieldColumn("cpu", types.FLOAT64)
updateTable.AddTimestampColumn("ts", types.TIMESTAMP_MILLISECOND)
// update data
monitor.Cpu = 1.1
// updated value, but other fileds value change to 0/false
err:= updateTable.AddRow(monitor.ID, monitor .Host, monitor .Cpu,
monitor .Ts)
...
// work
err :=updateTable.AddRow(monitor.ID, monitor.Host,monitor.Memory, monitor.Cpu, monitor.Temperature, monitor.Running,monitor.Ts)
I referenced Java update and SQL, the update operation contain all field.
I don't understand this question, can you help me figure this out?
Sorry, I've unassigned myself wrongly, please reassgin to me.
GreptimeDB doesn't support updating a row partially as it treats a row as a key-value pair. It always overwrites (replaces) the whole row so you need to provide all fields.
GreptimeDB doesn't support updating a row partially as it treats a row as a key-value pair. It always overwrites (replaces) the whole row so you need to provide all fields.
Yes. Updating scenarios for time-series databases are not very common. We currently do not support partial updates, although we may consider adding this feature in the future. However, we cannot commit to a specific timeline for its implementation. @JetSquirrel
Ok, thank you!
refer update-data to update row(s) in GreptimeDB