unitycatalog-client 0.2.1__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.
Files changed (82) hide show
  1. unitycatalog/client/__init__.py +102 -0
  2. unitycatalog/client/api/__init__.py +13 -0
  3. unitycatalog/client/api/catalogs_api.py +1404 -0
  4. unitycatalog/client/api/functions_api.py +1135 -0
  5. unitycatalog/client/api/grants_api.py +630 -0
  6. unitycatalog/client/api/model_versions_api.py +1748 -0
  7. unitycatalog/client/api/registered_models_api.py +1438 -0
  8. unitycatalog/client/api/schemas_api.py +1421 -0
  9. unitycatalog/client/api/tables_api.py +1135 -0
  10. unitycatalog/client/api/temporary_credentials_api.py +1109 -0
  11. unitycatalog/client/api/volumes_api.py +1421 -0
  12. unitycatalog/client/api_client.py +773 -0
  13. unitycatalog/client/api_response.py +21 -0
  14. unitycatalog/client/configuration.py +432 -0
  15. unitycatalog/client/exceptions.py +199 -0
  16. unitycatalog/client/models/__init__.py +77 -0
  17. unitycatalog/client/models/aws_credentials.py +91 -0
  18. unitycatalog/client/models/azure_user_delegation_sas.py +87 -0
  19. unitycatalog/client/models/catalog_info.py +103 -0
  20. unitycatalog/client/models/column_info.py +108 -0
  21. unitycatalog/client/models/column_type_name.py +56 -0
  22. unitycatalog/client/models/create_catalog.py +91 -0
  23. unitycatalog/client/models/create_function.py +163 -0
  24. unitycatalog/client/models/create_function_request.py +91 -0
  25. unitycatalog/client/models/create_model_version.py +97 -0
  26. unitycatalog/client/models/create_registered_model.py +93 -0
  27. unitycatalog/client/models/create_schema.py +93 -0
  28. unitycatalog/client/models/create_table.py +113 -0
  29. unitycatalog/client/models/create_volume_request_content.py +99 -0
  30. unitycatalog/client/models/data_source_format.py +42 -0
  31. unitycatalog/client/models/dependency.py +97 -0
  32. unitycatalog/client/models/dependency_list.py +95 -0
  33. unitycatalog/client/models/finalize_model_version.py +89 -0
  34. unitycatalog/client/models/function_dependency.py +87 -0
  35. unitycatalog/client/models/function_info.py +189 -0
  36. unitycatalog/client/models/function_parameter_info.py +112 -0
  37. unitycatalog/client/models/function_parameter_infos.py +95 -0
  38. unitycatalog/client/models/function_parameter_mode.py +36 -0
  39. unitycatalog/client/models/function_parameter_type.py +37 -0
  40. unitycatalog/client/models/gcp_oauth_token.py +87 -0
  41. unitycatalog/client/models/generate_temporary_model_version_credential.py +96 -0
  42. unitycatalog/client/models/generate_temporary_path_credential.py +90 -0
  43. unitycatalog/client/models/generate_temporary_table_credential.py +90 -0
  44. unitycatalog/client/models/generate_temporary_volume_credential.py +90 -0
  45. unitycatalog/client/models/list_catalogs_response.py +97 -0
  46. unitycatalog/client/models/list_functions_response.py +97 -0
  47. unitycatalog/client/models/list_model_versions_response.py +97 -0
  48. unitycatalog/client/models/list_registered_models_response.py +97 -0
  49. unitycatalog/client/models/list_schemas_response.py +97 -0
  50. unitycatalog/client/models/list_tables_response.py +97 -0
  51. unitycatalog/client/models/list_volumes_response_content.py +97 -0
  52. unitycatalog/client/models/model_version_info.py +114 -0
  53. unitycatalog/client/models/model_version_operation.py +38 -0
  54. unitycatalog/client/models/model_version_status.py +39 -0
  55. unitycatalog/client/models/path_operation.py +39 -0
  56. unitycatalog/client/models/permissions_change.py +92 -0
  57. unitycatalog/client/models/permissions_list.py +95 -0
  58. unitycatalog/client/models/principal_type.py +37 -0
  59. unitycatalog/client/models/privilege.py +47 -0
  60. unitycatalog/client/models/privilege_assignment.py +90 -0
  61. unitycatalog/client/models/registered_model_info.py +109 -0
  62. unitycatalog/client/models/schema_info.py +107 -0
  63. unitycatalog/client/models/securable_type.py +42 -0
  64. unitycatalog/client/models/table_dependency.py +87 -0
  65. unitycatalog/client/models/table_info.py +125 -0
  66. unitycatalog/client/models/table_operation.py +38 -0
  67. unitycatalog/client/models/table_type.py +37 -0
  68. unitycatalog/client/models/temporary_credentials.py +105 -0
  69. unitycatalog/client/models/update_catalog.py +91 -0
  70. unitycatalog/client/models/update_model_version.py +87 -0
  71. unitycatalog/client/models/update_permissions.py +95 -0
  72. unitycatalog/client/models/update_registered_model.py +89 -0
  73. unitycatalog/client/models/update_schema.py +91 -0
  74. unitycatalog/client/models/update_volume_request_content.py +90 -0
  75. unitycatalog/client/models/volume_info.py +113 -0
  76. unitycatalog/client/models/volume_operation.py +38 -0
  77. unitycatalog/client/models/volume_type.py +37 -0
  78. unitycatalog/client/py.typed +0 -0
  79. unitycatalog/client/rest.py +215 -0
  80. unitycatalog_client-0.2.1.dist-info/METADATA +199 -0
  81. unitycatalog_client-0.2.1.dist-info/RECORD +82 -0
  82. unitycatalog_client-0.2.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,163 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Unity Catalog API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from unitycatalog.client.models.column_type_name import ColumnTypeName
23
+ from unitycatalog.client.models.dependency_list import DependencyList
24
+ from unitycatalog.client.models.function_parameter_infos import FunctionParameterInfos
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class CreateFunction(BaseModel):
29
+ """
30
+ CreateFunction
31
+ """ # noqa: E501
32
+ name: StrictStr = Field(description="Name of function, relative to parent schema.")
33
+ catalog_name: StrictStr = Field(description="Name of parent catalog.")
34
+ schema_name: StrictStr = Field(description="Name of parent schema relative to its parent catalog.")
35
+ input_params: FunctionParameterInfos
36
+ data_type: ColumnTypeName
37
+ full_data_type: StrictStr = Field(description="Pretty printed function data type.")
38
+ return_params: Optional[FunctionParameterInfos] = None
39
+ routine_body: StrictStr = Field(description="Function language. When **EXTERNAL** is used, the language of the routine function should be specified in the __external_language__ field, and the __return_params__ of the function cannot be used (as **TABLE** return type is not supported), and the __sql_data_access__ field must be **NO_SQL**. ")
40
+ routine_definition: StrictStr = Field(description="Function body.")
41
+ routine_dependencies: Optional[DependencyList] = None
42
+ parameter_style: StrictStr = Field(description="Function parameter style. **S** is the value for SQL.")
43
+ is_deterministic: StrictBool = Field(description="Whether the function is deterministic.")
44
+ sql_data_access: StrictStr = Field(description="Function SQL data access.")
45
+ is_null_call: StrictBool = Field(description="Function null call.")
46
+ security_type: StrictStr = Field(description="Function security type.")
47
+ specific_name: StrictStr = Field(description="Specific name of the function; Reserved for future use.")
48
+ comment: Optional[StrictStr] = Field(default=None, description="User-provided free-form text description.")
49
+ properties: StrictStr = Field(description="JSON-serialized key-value pair map, encoded (escaped) as a string.")
50
+ external_language: Optional[StrictStr] = Field(default=None, description="External language of the function.")
51
+ __properties: ClassVar[List[str]] = ["name", "catalog_name", "schema_name", "input_params", "data_type", "full_data_type", "return_params", "routine_body", "routine_definition", "routine_dependencies", "parameter_style", "is_deterministic", "sql_data_access", "is_null_call", "security_type", "specific_name", "comment", "properties", "external_language"]
52
+
53
+ @field_validator('routine_body')
54
+ def routine_body_validate_enum(cls, value):
55
+ """Validates the enum"""
56
+ if value not in set(['SQL', 'EXTERNAL']):
57
+ raise ValueError("must be one of enum values ('SQL', 'EXTERNAL')")
58
+ return value
59
+
60
+ @field_validator('parameter_style')
61
+ def parameter_style_validate_enum(cls, value):
62
+ """Validates the enum"""
63
+ if value not in set(['S']):
64
+ raise ValueError("must be one of enum values ('S')")
65
+ return value
66
+
67
+ @field_validator('sql_data_access')
68
+ def sql_data_access_validate_enum(cls, value):
69
+ """Validates the enum"""
70
+ if value not in set(['CONTAINS_SQL', 'READS_SQL_DATA', 'NO_SQL']):
71
+ raise ValueError("must be one of enum values ('CONTAINS_SQL', 'READS_SQL_DATA', 'NO_SQL')")
72
+ return value
73
+
74
+ @field_validator('security_type')
75
+ def security_type_validate_enum(cls, value):
76
+ """Validates the enum"""
77
+ if value not in set(['DEFINER']):
78
+ raise ValueError("must be one of enum values ('DEFINER')")
79
+ return value
80
+
81
+ model_config = ConfigDict(
82
+ populate_by_name=True,
83
+ validate_assignment=True,
84
+ protected_namespaces=(),
85
+ )
86
+
87
+
88
+ def to_str(self) -> str:
89
+ """Returns the string representation of the model using alias"""
90
+ return pprint.pformat(self.model_dump(by_alias=True))
91
+
92
+ def to_json(self) -> str:
93
+ """Returns the JSON representation of the model using alias"""
94
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
95
+ return json.dumps(self.to_dict())
96
+
97
+ @classmethod
98
+ def from_json(cls, json_str: str) -> Optional[Self]:
99
+ """Create an instance of CreateFunction from a JSON string"""
100
+ return cls.from_dict(json.loads(json_str))
101
+
102
+ def to_dict(self) -> Dict[str, Any]:
103
+ """Return the dictionary representation of the model using alias.
104
+
105
+ This has the following differences from calling pydantic's
106
+ `self.model_dump(by_alias=True)`:
107
+
108
+ * `None` is only added to the output dict for nullable fields that
109
+ were set at model initialization. Other fields with value `None`
110
+ are ignored.
111
+ """
112
+ excluded_fields: Set[str] = set([
113
+ ])
114
+
115
+ _dict = self.model_dump(
116
+ by_alias=True,
117
+ exclude=excluded_fields,
118
+ exclude_none=True,
119
+ )
120
+ # override the default output from pydantic by calling `to_dict()` of input_params
121
+ if self.input_params:
122
+ _dict['input_params'] = self.input_params.to_dict()
123
+ # override the default output from pydantic by calling `to_dict()` of return_params
124
+ if self.return_params:
125
+ _dict['return_params'] = self.return_params.to_dict()
126
+ # override the default output from pydantic by calling `to_dict()` of routine_dependencies
127
+ if self.routine_dependencies:
128
+ _dict['routine_dependencies'] = self.routine_dependencies.to_dict()
129
+ return _dict
130
+
131
+ @classmethod
132
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
133
+ """Create an instance of CreateFunction from a dict"""
134
+ if obj is None:
135
+ return None
136
+
137
+ if not isinstance(obj, dict):
138
+ return cls.model_validate(obj)
139
+
140
+ _obj = cls.model_validate({
141
+ "name": obj.get("name"),
142
+ "catalog_name": obj.get("catalog_name"),
143
+ "schema_name": obj.get("schema_name"),
144
+ "input_params": FunctionParameterInfos.from_dict(obj["input_params"]) if obj.get("input_params") is not None else None,
145
+ "data_type": obj.get("data_type"),
146
+ "full_data_type": obj.get("full_data_type"),
147
+ "return_params": FunctionParameterInfos.from_dict(obj["return_params"]) if obj.get("return_params") is not None else None,
148
+ "routine_body": obj.get("routine_body"),
149
+ "routine_definition": obj.get("routine_definition"),
150
+ "routine_dependencies": DependencyList.from_dict(obj["routine_dependencies"]) if obj.get("routine_dependencies") is not None else None,
151
+ "parameter_style": obj.get("parameter_style"),
152
+ "is_deterministic": obj.get("is_deterministic"),
153
+ "sql_data_access": obj.get("sql_data_access"),
154
+ "is_null_call": obj.get("is_null_call"),
155
+ "security_type": obj.get("security_type"),
156
+ "specific_name": obj.get("specific_name"),
157
+ "comment": obj.get("comment"),
158
+ "properties": obj.get("properties"),
159
+ "external_language": obj.get("external_language")
160
+ })
161
+ return _obj
162
+
163
+
@@ -0,0 +1,91 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Unity Catalog API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict
21
+ from typing import Any, ClassVar, Dict, List
22
+ from unitycatalog.client.models.create_function import CreateFunction
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class CreateFunctionRequest(BaseModel):
27
+ """
28
+ CreateFunctionRequest
29
+ """ # noqa: E501
30
+ function_info: CreateFunction
31
+ __properties: ClassVar[List[str]] = ["function_info"]
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+
40
+ def to_str(self) -> str:
41
+ """Returns the string representation of the model using alias"""
42
+ return pprint.pformat(self.model_dump(by_alias=True))
43
+
44
+ def to_json(self) -> str:
45
+ """Returns the JSON representation of the model using alias"""
46
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
47
+ return json.dumps(self.to_dict())
48
+
49
+ @classmethod
50
+ def from_json(cls, json_str: str) -> Optional[Self]:
51
+ """Create an instance of CreateFunctionRequest from a JSON string"""
52
+ return cls.from_dict(json.loads(json_str))
53
+
54
+ def to_dict(self) -> Dict[str, Any]:
55
+ """Return the dictionary representation of the model using alias.
56
+
57
+ This has the following differences from calling pydantic's
58
+ `self.model_dump(by_alias=True)`:
59
+
60
+ * `None` is only added to the output dict for nullable fields that
61
+ were set at model initialization. Other fields with value `None`
62
+ are ignored.
63
+ """
64
+ excluded_fields: Set[str] = set([
65
+ ])
66
+
67
+ _dict = self.model_dump(
68
+ by_alias=True,
69
+ exclude=excluded_fields,
70
+ exclude_none=True,
71
+ )
72
+ # override the default output from pydantic by calling `to_dict()` of function_info
73
+ if self.function_info:
74
+ _dict['function_info'] = self.function_info.to_dict()
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of CreateFunctionRequest from a dict"""
80
+ if obj is None:
81
+ return None
82
+
83
+ if not isinstance(obj, dict):
84
+ return cls.model_validate(obj)
85
+
86
+ _obj = cls.model_validate({
87
+ "function_info": CreateFunction.from_dict(obj["function_info"]) if obj.get("function_info") is not None else None
88
+ })
89
+ return _obj
90
+
91
+
@@ -0,0 +1,97 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Unity Catalog API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class CreateModelVersion(BaseModel):
26
+ """
27
+ CreateModelVersion
28
+ """ # noqa: E501
29
+ model_name: StrictStr = Field(description="Name of registered model, relative to parent schema.")
30
+ catalog_name: StrictStr = Field(description="Name of parent catalog.")
31
+ schema_name: StrictStr = Field(description="Name of parent schema relative to its parent catalog.")
32
+ source: StrictStr = Field(description="URI indicating the location of the source model artifacts.")
33
+ run_id: Optional[StrictStr] = Field(default=None, description="The run id used by the ML package that generated the model.")
34
+ comment: Optional[StrictStr] = Field(default=None, description="User-provided free-form text description.")
35
+ __properties: ClassVar[List[str]] = ["model_name", "catalog_name", "schema_name", "source", "run_id", "comment"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of CreateModelVersion from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([
69
+ ])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of CreateModelVersion from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate({
88
+ "model_name": obj.get("model_name"),
89
+ "catalog_name": obj.get("catalog_name"),
90
+ "schema_name": obj.get("schema_name"),
91
+ "source": obj.get("source"),
92
+ "run_id": obj.get("run_id"),
93
+ "comment": obj.get("comment")
94
+ })
95
+ return _obj
96
+
97
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Unity Catalog API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class CreateRegisteredModel(BaseModel):
26
+ """
27
+ CreateRegisteredModel
28
+ """ # noqa: E501
29
+ name: StrictStr = Field(description="Name of model, relative to parent schema.")
30
+ catalog_name: StrictStr = Field(description="Name of parent catalog.")
31
+ schema_name: StrictStr = Field(description="Name of parent schema relative to its parent catalog.")
32
+ comment: Optional[StrictStr] = Field(default=None, description="User-provided free-form text description.")
33
+ __properties: ClassVar[List[str]] = ["name", "catalog_name", "schema_name", "comment"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of CreateRegisteredModel from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of CreateRegisteredModel from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "name": obj.get("name"),
87
+ "catalog_name": obj.get("catalog_name"),
88
+ "schema_name": obj.get("schema_name"),
89
+ "comment": obj.get("comment")
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,93 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Unity Catalog API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class CreateSchema(BaseModel):
26
+ """
27
+ CreateSchema
28
+ """ # noqa: E501
29
+ name: StrictStr = Field(description="Name of schema, relative to parent catalog.")
30
+ catalog_name: StrictStr = Field(description="Name of parent catalog.")
31
+ comment: Optional[StrictStr] = Field(default=None, description="User-provided free-form text description.")
32
+ properties: Optional[Dict[str, StrictStr]] = Field(default=None, description="A map of key-value properties attached to the securable.")
33
+ __properties: ClassVar[List[str]] = ["name", "catalog_name", "comment", "properties"]
34
+
35
+ model_config = ConfigDict(
36
+ populate_by_name=True,
37
+ validate_assignment=True,
38
+ protected_namespaces=(),
39
+ )
40
+
41
+
42
+ def to_str(self) -> str:
43
+ """Returns the string representation of the model using alias"""
44
+ return pprint.pformat(self.model_dump(by_alias=True))
45
+
46
+ def to_json(self) -> str:
47
+ """Returns the JSON representation of the model using alias"""
48
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
+ return json.dumps(self.to_dict())
50
+
51
+ @classmethod
52
+ def from_json(cls, json_str: str) -> Optional[Self]:
53
+ """Create an instance of CreateSchema from a JSON string"""
54
+ return cls.from_dict(json.loads(json_str))
55
+
56
+ def to_dict(self) -> Dict[str, Any]:
57
+ """Return the dictionary representation of the model using alias.
58
+
59
+ This has the following differences from calling pydantic's
60
+ `self.model_dump(by_alias=True)`:
61
+
62
+ * `None` is only added to the output dict for nullable fields that
63
+ were set at model initialization. Other fields with value `None`
64
+ are ignored.
65
+ """
66
+ excluded_fields: Set[str] = set([
67
+ ])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ return _dict
75
+
76
+ @classmethod
77
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
+ """Create an instance of CreateSchema from a dict"""
79
+ if obj is None:
80
+ return None
81
+
82
+ if not isinstance(obj, dict):
83
+ return cls.model_validate(obj)
84
+
85
+ _obj = cls.model_validate({
86
+ "name": obj.get("name"),
87
+ "catalog_name": obj.get("catalog_name"),
88
+ "comment": obj.get("comment"),
89
+ "properties": obj.get("properties")
90
+ })
91
+ return _obj
92
+
93
+
@@ -0,0 +1,113 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Unity Catalog API
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: 0.1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from unitycatalog.client.models.column_info import ColumnInfo
23
+ from unitycatalog.client.models.data_source_format import DataSourceFormat
24
+ from unitycatalog.client.models.table_type import TableType
25
+ from typing import Optional, Set
26
+ from typing_extensions import Self
27
+
28
+ class CreateTable(BaseModel):
29
+ """
30
+ CreateTable
31
+ """ # noqa: E501
32
+ name: StrictStr = Field(description="Name of table, relative to parent schema.")
33
+ catalog_name: StrictStr = Field(description="Name of parent catalog.")
34
+ schema_name: StrictStr = Field(description="Name of parent schema relative to its parent catalog.")
35
+ table_type: TableType
36
+ data_source_format: DataSourceFormat
37
+ columns: List[ColumnInfo] = Field(description="The array of __ColumnInfo__ definitions of the table's columns.")
38
+ storage_location: StrictStr = Field(description="Storage root URL for external table")
39
+ comment: Optional[StrictStr] = Field(default=None, description="User-provided free-form text description.")
40
+ properties: Optional[Dict[str, StrictStr]] = Field(default=None, description="A map of key-value properties attached to the securable.")
41
+ __properties: ClassVar[List[str]] = ["name", "catalog_name", "schema_name", "table_type", "data_source_format", "columns", "storage_location", "comment", "properties"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of CreateTable from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([
75
+ ])
76
+
77
+ _dict = self.model_dump(
78
+ by_alias=True,
79
+ exclude=excluded_fields,
80
+ exclude_none=True,
81
+ )
82
+ # override the default output from pydantic by calling `to_dict()` of each item in columns (list)
83
+ _items = []
84
+ if self.columns:
85
+ for _item in self.columns:
86
+ if _item:
87
+ _items.append(_item.to_dict())
88
+ _dict['columns'] = _items
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of CreateTable from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate({
101
+ "name": obj.get("name"),
102
+ "catalog_name": obj.get("catalog_name"),
103
+ "schema_name": obj.get("schema_name"),
104
+ "table_type": obj.get("table_type"),
105
+ "data_source_format": obj.get("data_source_format"),
106
+ "columns": [ColumnInfo.from_dict(_item) for _item in obj["columns"]] if obj.get("columns") is not None else None,
107
+ "storage_location": obj.get("storage_location"),
108
+ "comment": obj.get("comment"),
109
+ "properties": obj.get("properties")
110
+ })
111
+ return _obj
112
+
113
+