Creates a data contract from an Apache Iceberg table schema.
{/* AUTOGENERATED EXAMPLE: do not edit by hand; regenerate with the update script. */}
Given this orders.json:
{
"type": "struct",
"fields": [
{ "id": 1, "name": "order_id", "type": "string", "required": true },
{ "id": 2, "name": "order_timestamp", "type": "timestamptz", "required": true },
{ "id": 3, "name": "customer_id", "type": "string", "required": true },
{ "id": 4, "name": "order_total", "type": "long", "required": true },
{ "id": 5, "name": "status", "type": "string", "required": true }
],
"schema-id": 0,
"identifier-field-ids": [1]
}
Run:
datacontract import iceberg --source orders.json
to produce the data contract:
version: 1.0.0
kind: DataContract
apiVersion: v3.1.0
id: my-data-contract
name: My Data Contract
status: draft
schema:
- name: iceberg_table
physicalType: table
logicalType: object
physicalName: iceberg_table
properties:
- name: order_id
physicalType: string
customProperties:
- property: icebergFieldId
value: 1
primaryKey: true
primaryKeyPosition: 1
logicalType: string
required: true
- name: order_timestamp
physicalType: timestamptz
customProperties:
- property: icebergFieldId
value: 2
logicalType: date
required: true
- name: customer_id
physicalType: string
customProperties:
- property: icebergFieldId
value: 3
logicalType: string
# …
{/* END AUTOGENERATED EXAMPLE */}