Skip to content

Instantly share code, notes, and snippets.

@cmackenzie1
Created June 15, 2023 16:24
Show Gist options
  • Save cmackenzie1/1e42249c784f410edcc14d6ef3d075ed to your computer and use it in GitHub Desktop.
Save cmackenzie1/1e42249c784f410edcc14d6ef3d075ed to your computer and use it in GitHub Desktop.
Define Delta Lake table schemas in YAML.
# A top-level `type: struct` is a `Schema`
# These can be serialized into a deltalake::Schema struct using serde_yaml in rust
# let schema: deltalake::Schema = serde_yaml::from_str(r#"<your yaml>");
---
# A struct with primitive fields
type: struct
fields:
- name: String
type: string
nullable: true
metadata: {}
- name: Long
type: long
nullable: true
metadata: {}
---
# Schema with an Array
type: struct
fields:
- name: Array
type: # for anything not primitive, this field must be a map type
type: array
elementType: integer
containsNull: true
nullable: true
metadata: {}
---
# Schema with a struct field
type: struct
fields:
- name: Struct
type: # for anything not primitive, this field must be a map type
type: struct
fields:
- name: Integer
type: integer
nullable: true
metadata: {}
nullable: true
metadata: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment