Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update remote store id field name #8626

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions examples/python/remote/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,18 @@
print(f"Registered new recording with ID: {id}")

elif args.subcommand == "update":
id = catalog.filter(catalog["id"].str.starts_with(args.id)).select(pl.first("id")).item()
id = (
catalog.filter(catalog["rerun_recording_id"].str.starts_with(args.id))
.select(pl.first("rerun_recording_id"))
.item()
)

if id is None:
print("ID not found")
exit(1)
print(f"Updating metadata for {id}")

new_metadata = pa.Table.from_pydict({"id": [id], args.key: [args.value]})
new_metadata = pa.Table.from_pydict({"rerun_recording_id": [id], args.key: [args.value]})
print(new_metadata)

conn.update_catalog(new_metadata)
14 changes: 9 additions & 5 deletions rerun_py/src/remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ impl PyStorageNodeClient {

let recording_id = metadata
.all_columns()
.find(|(field, _data)| field.name == "id")
.find(|(field, _data)| field.name == "rerun_recording_id")
.map(|(_field, data)| data)
.ok_or(PyRuntimeError::new_err("No id"))?
.ok_or(PyRuntimeError::new_err("No rerun_recording_id"))?
.as_any()
.downcast_ref::<arrow2::array::Utf8Array<i32>>()
.ok_or(PyRuntimeError::new_err("Id is not a string"))?
.ok_or(PyRuntimeError::new_err("Recording Id is not a string"))?
.value(0)
.to_owned();

Expand All @@ -325,9 +325,13 @@ impl PyStorageNodeClient {
let metadata = metadata.into_record_batch()?;

// TODO(jleibs): This id name should probably come from `re_protos`
if metadata.schema().column_with_name("id").is_none() {
if metadata
.schema()
.column_with_name("rerun_recording_id")
.is_none()
{
return Err(PyRuntimeError::new_err(
"Metadata must contain an 'id' column",
"Metadata must contain 'rerun_recording_id' column",
));
}

Expand Down
Loading