Create a Compute Resource with datacontract-cli Python Library
To efficiently use the Data Contract CLI, it is recommended to create a compute resource in Databricks with the Python library installed.
Also, create an API Key and set the environment variable DATAMESH_MANAGER_API_KEY to the API key value in the compute configuration.

Import with Data Contract CLI
from datacontract.data_contract import DataContract
from datacontract.integration.datamesh_manager import publish_data_contract_to_datamesh_manager
# import existing table structure
data_contract_specification = DataContract(spark=spark).import_from_source(
format="unity",
unity_table_full_name="demo_org_masterdata_prod.dp_country_codes_op_v1.country_codes")
# print
print(data_contract_specification.to_yaml())
# update the data contract
data_contract_specification.id = "country_codes"
data_contract_specification.info.title = "Country Codes"
data_contract_specification.info.owner = "master-data"
data_contract_specification.models['country_codes'].description="ISO codes for every country we work with"
# print again
print(data_contract_specification.to_yaml())
# env variable DATAMESH_MANAGER_API_KEY must be set
publish_data_contract_to_datamesh_manager(data_contract_dict=data_contract_specification.dict(), ssl_verification=True)