Skip to content

Commit 597c1a6

Browse files
committed
Update to 1.2.0
1 parent 6c18365 commit 597c1a6

File tree

4 files changed

+119
-15
lines changed

4 files changed

+119
-15
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ The version number of the pip module corresponds to the version of the Data Cont
88

99
| Data Contract Specification Version | Pip Module Version |
1010
|-------------------------------------|--------------------|
11+
| 1.2.0 | >=1.2.0 |
1112
| 1.1.0 | >=1.1.0 |
1213

1314
**Note**: We mirror major and minor version from the Data Contract Specification to the pip module, but not the patch version!
@@ -34,7 +35,7 @@ from datacontract_specification.model import DataContractSpecification
3435

3536
# Load a data contract specification from a string
3637
data_contract_str = """
37-
dataContractSpecification: 1.1.0
38+
dataContractSpecification: 1.2.0
3839
id: urn:datacontract:checkout:orders-latest
3940
info:
4041
title: Orders Latest

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "datacontract-specification"
3-
version = "1.1.1" # in sync with spec
3+
version = "1.2.0" # in sync with spec
44
description = "The Pydantic Model of the Data Contract Specification"
55
readme = "README.md"
66
authors = [

src/datacontract_specification/model.py

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,15 @@
2323
"timestamp_tz",
2424
"timestamp_ntz",
2525
"date",
26+
"time",
2627
"array",
27-
"bytes",
28+
"map",
2829
"object",
2930
"record",
3031
"struct",
32+
"bytes",
33+
"variant",
34+
"json",
3135
"null",
3236
]
3337

@@ -42,6 +46,48 @@ class Contact(pyd.BaseModel):
4246
)
4347

4448

49+
class Policy(pyd.BaseModel):
50+
type: str | None = None
51+
description: str | None = None
52+
url: str | None = None
53+
54+
model_config = pyd.ConfigDict(
55+
extra="allow",
56+
)
57+
58+
59+
class Transformation(pyd.BaseModel):
60+
type: str | None = None
61+
subtype: str | None = None
62+
description: str | None = None
63+
masking: bool | None = None
64+
65+
model_config = pyd.ConfigDict(
66+
extra="allow",
67+
)
68+
69+
70+
class InputField(pyd.BaseModel):
71+
namespace: str | None = None
72+
name: str | None = None
73+
field: str | None = None
74+
transformations: List[Transformation] | None = None
75+
76+
model_config = pyd.ConfigDict(
77+
extra="allow",
78+
)
79+
80+
81+
class Lineage(pyd.BaseModel):
82+
inputFields: List[InputField] | None = None
83+
transformationDescription: str | None = None
84+
transformationType: str | None = None
85+
86+
model_config = pyd.ConfigDict(
87+
extra="allow",
88+
)
89+
90+
4591
class ServerRole(pyd.BaseModel):
4692
name: str | None = None
4793
description: str | None = None
@@ -84,6 +130,7 @@ class Server(pyd.BaseModel):
84130
class Terms(pyd.BaseModel):
85131
usage: str | None = None
86132
limitations: str | None = None
133+
policies: List[Policy] | None = None
87134
billing: str | None = None
88135
noticePeriod: str | None = None
89136
description: str | None = None
@@ -181,6 +228,7 @@ class Field(pyd.BaseModel):
181228
)
182229
examples: List[Any] | None = None
183230
quality: List[Quality] | None = []
231+
lineage: Lineage | None = None
184232
config: Dict[str, Any] | None = None
185233

186234
model_config = pyd.ConfigDict(
@@ -197,6 +245,7 @@ class Model(pyd.BaseModel):
197245
quality: List[Quality] | None = []
198246
primaryKey: List[str] | None = []
199247
examples: List[Any] | None = None
248+
additionalFields: bool | None = None
200249
config: Dict[str, Any] = None
201250
tags: List[str] | None = None
202251

src/datacontract_specification/schema.json

Lines changed: 66 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"type": "string",
88
"title": "DataContractSpecificationVersion",
99
"enum": [
10+
"1.2.0",
1011
"1.1.0",
1112
"0.9.3",
1213
"0.9.2",
@@ -336,6 +337,21 @@
336337
"$ref": "#/$defs/TrinoServer"
337338
}
338339
},
340+
{
341+
"if": {
342+
"properties": {
343+
"type": {
344+
"const": "clickhouse"
345+
}
346+
},
347+
"required": [
348+
"type"
349+
]
350+
},
351+
"then": {
352+
"$ref": "#/$defs/ClickhouseServer"
353+
}
354+
},
339355
{
340356
"if": {
341357
"properties": {
@@ -689,6 +705,11 @@
689705
"examples": {
690706
"type": "array"
691707
},
708+
"additionalFields": {
709+
"type": "boolean",
710+
"description": " Specify, if the model can have additional fields that are not defined in the contract. ",
711+
"default": false
712+
},
692713
"config": {
693714
"type": "object",
694715
"description": "Additional metadata for model configuration.",
@@ -1092,12 +1113,15 @@
10921113
"timestamp_tz",
10931114
"timestamp_ntz",
10941115
"date",
1116+
"time",
10951117
"array",
10961118
"map",
10971119
"object",
10981120
"record",
10991121
"struct",
11001122
"bytes",
1123+
"variant",
1124+
"json",
11011125
"null"
11021126
]
11031127
},
@@ -1115,25 +1139,26 @@
11151139
"type": {
11161140
"type": "string",
11171141
"description": "The type of the data product technology that implements the data contract.",
1118-
"enum": [
1142+
"examples": [
1143+
"azure",
11191144
"bigquery",
11201145
"BigQuery",
1121-
"s3",
1122-
"sftp",
1123-
"redshift",
1124-
"azure",
1125-
"sqlserver",
1126-
"snowflake",
1146+
"clickhouse",
11271147
"databricks",
11281148
"dataframe",
11291149
"glue",
1130-
"postgres",
1131-
"oracle",
11321150
"kafka",
1133-
"pubsub",
11341151
"kinesis",
1135-
"trino",
1136-
"local"
1152+
"local",
1153+
"oracle",
1154+
"postgres",
1155+
"pubsub",
1156+
"redshift",
1157+
"sftp",
1158+
"sqlserver",
1159+
"snowflake",
1160+
"s3",
1161+
"trino"
11371162
]
11381163
},
11391164
"roles": {
@@ -1663,6 +1688,35 @@
16631688
"schema"
16641689
]
16651690
},
1691+
"ClickhouseServer": {
1692+
"type": "object",
1693+
"title": "ClickhouseServer",
1694+
"properties": {
1695+
"host": {
1696+
"type": "string",
1697+
"description": "The host to the database server",
1698+
"examples": [
1699+
"localhost"
1700+
]
1701+
},
1702+
"port": {
1703+
"type": "integer",
1704+
"description": "The port to the database server."
1705+
},
1706+
"database": {
1707+
"type": "string",
1708+
"description": "The name of the database.",
1709+
"examples": [
1710+
"postgres"
1711+
]
1712+
}
1713+
},
1714+
"required": [
1715+
"host",
1716+
"port",
1717+
"database"
1718+
]
1719+
},
16661720
"LocalServer": {
16671721
"type": "object",
16681722
"title": "LocalServer",

0 commit comments

Comments
 (0)