datacontract-cli 0.10.18__py3-none-any.whl → 0.10.20__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of datacontract-cli might be problematic. Click here for more details.

Files changed (30) hide show
  1. datacontract/cli.py +22 -30
  2. datacontract/data_contract.py +7 -8
  3. datacontract/engines/soda/connections/duckdb.py +22 -9
  4. datacontract/export/data_caterer_converter.py +20 -7
  5. datacontract/export/sodacl_converter.py +21 -4
  6. datacontract/export/sql_type_converter.py +7 -2
  7. datacontract/imports/csv_importer.py +89 -0
  8. datacontract/imports/importer.py +1 -0
  9. datacontract/imports/importer_factory.py +5 -0
  10. datacontract/init/init_template.py +20 -0
  11. datacontract/integration/datamesh_manager.py +5 -10
  12. datacontract/lint/linters/field_reference_linter.py +10 -1
  13. datacontract/lint/resolve.py +22 -1
  14. datacontract/lint/schema.py +10 -3
  15. datacontract/lint/urls.py +9 -5
  16. datacontract/model/data_contract_specification.py +2 -0
  17. datacontract/schemas/datacontract-1.1.0.init.yaml +91 -0
  18. datacontract/schemas/datacontract-1.1.0.schema.json +1975 -0
  19. datacontract/schemas/odcs-3.0.1.schema.json +2634 -0
  20. datacontract/templates/datacontract.html +20 -1
  21. datacontract/templates/partials/definition.html +15 -5
  22. datacontract/templates/partials/model_field.html +9 -0
  23. datacontract/web.py +170 -36
  24. {datacontract_cli-0.10.18.dist-info → datacontract_cli-0.10.20.dist-info}/METADATA +448 -297
  25. {datacontract_cli-0.10.18.dist-info → datacontract_cli-0.10.20.dist-info}/RECORD +29 -25
  26. datacontract/init/download_datacontract_file.py +0 -17
  27. {datacontract_cli-0.10.18.dist-info → datacontract_cli-0.10.20.dist-info}/LICENSE +0 -0
  28. {datacontract_cli-0.10.18.dist-info → datacontract_cli-0.10.20.dist-info}/WHEEL +0 -0
  29. {datacontract_cli-0.10.18.dist-info → datacontract_cli-0.10.20.dist-info}/entry_points.txt +0 -0
  30. {datacontract_cli-0.10.18.dist-info → datacontract_cli-0.10.20.dist-info}/top_level.txt +0 -0
datacontract/lint/urls.py CHANGED
@@ -27,8 +27,11 @@ def fetch_resource(url: str):
27
27
 
28
28
  def _set_api_key(headers, url):
29
29
  hostname = urlparse(url).hostname
30
+
31
+ datamesh_manager_api_key = os.getenv("DATAMESH_MANAGER_API_KEY")
32
+ datacontract_manager_api_key = os.getenv("DATACONTRACT_MANAGER_API_KEY")
33
+
30
34
  if hostname == "datamesh-manager.com" or hostname.endswith(".datamesh-manager.com"):
31
- datamesh_manager_api_key = os.getenv("DATAMESH_MANAGER_API_KEY")
32
35
  if datamesh_manager_api_key is None or datamesh_manager_api_key == "":
33
36
  print("Error: Data Mesh Manager API Key is not set. Set env variable DATAMESH_MANAGER_API_KEY.")
34
37
  raise DataContractException(
@@ -40,7 +43,6 @@ def _set_api_key(headers, url):
40
43
  )
41
44
  headers["x-api-key"] = datamesh_manager_api_key
42
45
  elif hostname == "datacontract-manager.com" or hostname.endswith(".datacontract-manager.com"):
43
- datacontract_manager_api_key = os.getenv("DATACONTRACT_MANAGER_API_KEY")
44
46
  if datacontract_manager_api_key is None or datacontract_manager_api_key == "":
45
47
  print("Error: Data Contract Manager API Key is not set. Set env variable DATACONTRACT_MANAGER_API_KEY.")
46
48
  raise DataContractException(
@@ -51,6 +53,8 @@ def _set_api_key(headers, url):
51
53
  result="error",
52
54
  )
53
55
  headers["x-api-key"] = datacontract_manager_api_key
54
- else:
55
- # do nothing
56
- pass
56
+
57
+ if datamesh_manager_api_key is not None and datamesh_manager_api_key != "":
58
+ headers["x-api-key"] = datamesh_manager_api_key
59
+ if datacontract_manager_api_key is not None and datacontract_manager_api_key != "":
60
+ headers["x-api-key"] = datacontract_manager_api_key
@@ -72,6 +72,7 @@ class Server(pyd.BaseModel):
72
72
  dataProductId: str = None
73
73
  outputPortId: str = None
74
74
  driver: str = None
75
+ storageAccount: str = None
75
76
  roles: List[ServerRole] = None
76
77
 
77
78
  model_config = pyd.ConfigDict(
@@ -112,6 +113,7 @@ class Definition(pyd.BaseModel):
112
113
  tags: List[str] = []
113
114
  links: Dict[str, str] = {}
114
115
  example: str = None
116
+ examples: List[Any] | None = None
115
117
 
116
118
  model_config = pyd.ConfigDict(
117
119
  extra="allow",
@@ -0,0 +1,91 @@
1
+ dataContractSpecification: 1.1.0
2
+ id: my-data-contract-id
3
+ info:
4
+ title: My Data Contract
5
+ version: 0.0.1
6
+ # description:
7
+ # owner:
8
+ # contact:
9
+ # name:
10
+ # url:
11
+ # email:
12
+
13
+
14
+ ### servers
15
+
16
+ #servers:
17
+ # production:
18
+ # type: s3
19
+ # location: s3://
20
+ # format: parquet
21
+ # delimiter: new_line
22
+
23
+ ### terms
24
+
25
+ #terms:
26
+ # usage:
27
+ # limitations:
28
+ # billing:
29
+ # noticePeriod:
30
+
31
+
32
+ ### models
33
+
34
+ # models:
35
+ # my_model:
36
+ # description:
37
+ # type:
38
+ # fields:
39
+ # my_field:
40
+ # type:
41
+ # description:
42
+
43
+
44
+ ### definitions
45
+
46
+ # definitions:
47
+ # my_field:
48
+ # domain:
49
+ # name:
50
+ # title:
51
+ # type:
52
+ # description:
53
+ # example:
54
+ # pii:
55
+ # classification:
56
+
57
+
58
+ ### servicelevels
59
+
60
+ #servicelevels:
61
+ # availability:
62
+ # description: The server is available during support hours
63
+ # percentage: 99.9%
64
+ # retention:
65
+ # description: Data is retained for one year because!
66
+ # period: P1Y
67
+ # unlimited: false
68
+ # latency:
69
+ # description: Data is available within 25 hours after the order was placed
70
+ # threshold: 25h
71
+ # sourceTimestampField: orders.order_timestamp
72
+ # processedTimestampField: orders.processed_timestamp
73
+ # freshness:
74
+ # description: The age of the youngest row in a table.
75
+ # threshold: 25h
76
+ # timestampField: orders.order_timestamp
77
+ # frequency:
78
+ # description: Data is delivered once a day
79
+ # type: batch # or streaming
80
+ # interval: daily # for batch, either or cron
81
+ # cron: 0 0 * * * # for batch, either or interval
82
+ # support:
83
+ # description: The data is available during typical business hours at headquarters
84
+ # time: 9am to 5pm in EST on business days
85
+ # responseTime: 1h
86
+ # backup:
87
+ # description: Data is backed up once a week, every Sunday at 0:00 UTC.
88
+ # interval: weekly
89
+ # cron: 0 0 * * 0
90
+ # recoveryTime: 24 hours
91
+ # recoveryPoint: 1 week