Schema.serialize#

classmethod Schema.serialize() str[source]#

Serialize this schema to a JSON string.

Returns:

The serialized schema.

Note

Serialization within dataframely itself will remain backwards-compatible at least within a major version. Until further notice, it will also be backwards-compatible across major versions.

Attention

Serialization of polars expressions is not guaranteed to be stable across versions of polars. This affects schemas that define custom rules or columns with custom checks: a schema serialized with one version of polars may not be deserializable with another version of polars.

Attention

This functionality is considered unstable. It may be changed at any time without it being considered a breaking change.

Raises:
  • TypeError – If any column contains metadata that is not JSON-serializable.

  • ValueError – If any column is not a “native” dataframely column type but a custom subclass.