fix: refuse graph schemas a definition cannot carry, and take any Table.add input on insert

A node or edge type whose schema would read back as another type from its JSON form (timestamp units and time zones, durations, times, dictionaries) is refused before a request carries it. Inserting into a property graph registers DataFrame converters first, as Table.add does, and the async graph handles are in the API reference.
This commit is contained in:
Jack Ye
2026-09-29 09:13:42 -05:00
parent 973a793d18
commit 5f4d448a34
5 changed files with 180 additions and 8 deletions
+3 -2
View File
@@ -29,10 +29,11 @@ impl GraphKind {
}
}
/// A pyarrow schema as the JSON Arrow schema of a node or edge type.
/// A pyarrow schema as the JSON Arrow schema of a node or edge type, refused
/// when that form would not read back as the same schema.
#[pyfunction]
pub fn graph_schema_to_json(schema: PyArrowType<Schema>) -> PyResult<String> {
let json = lance_namespace::schema::arrow_schema_to_json(&schema.0)
let json = lancedb::graph::schema_to_json(&schema.0)
.map_err(|error| PyValueError::new_err(error.to_string()))?;
serde_json::to_string(&json).map_err(|error| PyValueError::new_err(error.to_string()))
}