Brain Docs

Reference

Python SDKInstallationHTTP clientWire clientSync vs async
get_schemavalidate_schemaupload_schemareplace_schemadrop_schemalist_schemaslist_extractors
ErrorsRetriesPagination
Brain/Docs
✦ ASKBrain on GitHubDashboard
Python SDKSchemareplace_schema

replace_schema

Replace the schema wholesale — and read the count of live rows it destroyed.

PURPOSE

Replace the schema wholesale rather than publishing a compatible new version. Rows that no longer fit are dropped — and you have to say so explicitly.

PUT/v1/schemaBearer API keystable
replace_schema(schema_document: str, force_drop_existing: bool) -> SchemaReplace
Handshake credentialstable
replace_schema(request: SchemaReplaceRequest) -> SchemaReplaceResponse

Parameters

ParameterTypeRequired
schema_documentstringrequired

The replacement.

force_drop_existingbooleanrequired

Required, not optional — you must state whether rows that no longer fit may be dropped. false makes the call fail rather than destroy data.

Returns

FieldTypePresence
namespace / schema_version—always

Where it landed.

dropped_countintegeralways

The number of live rows this replacement destroyed. Read it.

validation_errorsSchemaError[]always

Empty on success.

Validation failures are not exceptions

This verb resolves with a populated validationErrors array rather than throwing. Code that only wraps the call in a try/catch treats an invalid schema as a successful one. Check the array.

See also
upload_schemadrop_schema

Was this page helpful?

upload_schema

Publish a new schema version, with a dry run and an explicit opt-in for breaking changes.

drop_schema

Remove one declaration — and find out how many live rows still depend on it.

On this page

ParametersReturns
Suggest an editOpen in Playground