databricks-sdk 0.64.0__py3-none-any.whl → 0.66.0__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 databricks-sdk might be problematic. Click here for more details.

@@ -512,6 +512,30 @@ class CreateWebhookResponse:
512
512
  return cls(webhook=_from_dict(d, "webhook", RegistryWebhook))
513
513
 
514
514
 
515
+ @dataclass
516
+ class DataSource:
517
+ delta_table_source: Optional[DeltaTableSource] = None
518
+
519
+ def as_dict(self) -> dict:
520
+ """Serializes the DataSource into a dictionary suitable for use as a JSON request body."""
521
+ body = {}
522
+ if self.delta_table_source:
523
+ body["delta_table_source"] = self.delta_table_source.as_dict()
524
+ return body
525
+
526
+ def as_shallow_dict(self) -> dict:
527
+ """Serializes the DataSource into a shallow dictionary of its immediate attributes."""
528
+ body = {}
529
+ if self.delta_table_source:
530
+ body["delta_table_source"] = self.delta_table_source
531
+ return body
532
+
533
+ @classmethod
534
+ def from_dict(cls, d: Dict[str, Any]) -> DataSource:
535
+ """Deserializes the DataSource from a dictionary."""
536
+ return cls(delta_table_source=_from_dict(d, "delta_table_source", DeltaTableSource))
537
+
538
+
515
539
  @dataclass
516
540
  class Dataset:
517
541
  """Dataset. Represents a reference to data used for training, testing, or evaluation during the
@@ -868,6 +892,49 @@ class DeleteWebhookResponse:
868
892
  return cls()
869
893
 
870
894
 
895
+ @dataclass
896
+ class DeltaTableSource:
897
+ full_name: str
898
+ """The full three-part (catalog, schema, table) name of the Delta table."""
899
+
900
+ entity_columns: List[str]
901
+ """The entity columns of the Delta table."""
902
+
903
+ timeseries_column: str
904
+ """The timeseries column of the Delta table."""
905
+
906
+ def as_dict(self) -> dict:
907
+ """Serializes the DeltaTableSource into a dictionary suitable for use as a JSON request body."""
908
+ body = {}
909
+ if self.entity_columns:
910
+ body["entity_columns"] = [v for v in self.entity_columns]
911
+ if self.full_name is not None:
912
+ body["full_name"] = self.full_name
913
+ if self.timeseries_column is not None:
914
+ body["timeseries_column"] = self.timeseries_column
915
+ return body
916
+
917
+ def as_shallow_dict(self) -> dict:
918
+ """Serializes the DeltaTableSource into a shallow dictionary of its immediate attributes."""
919
+ body = {}
920
+ if self.entity_columns:
921
+ body["entity_columns"] = self.entity_columns
922
+ if self.full_name is not None:
923
+ body["full_name"] = self.full_name
924
+ if self.timeseries_column is not None:
925
+ body["timeseries_column"] = self.timeseries_column
926
+ return body
927
+
928
+ @classmethod
929
+ def from_dict(cls, d: Dict[str, Any]) -> DeltaTableSource:
930
+ """Deserializes the DeltaTableSource from a dictionary."""
931
+ return cls(
932
+ entity_columns=d.get("entity_columns", None),
933
+ full_name=d.get("full_name", None),
934
+ timeseries_column=d.get("timeseries_column", None),
935
+ )
936
+
937
+
871
938
  @dataclass
872
939
  class Experiment:
873
940
  """An experiment and its metadata."""
@@ -1212,46 +1279,68 @@ class ExperimentTag:
1212
1279
 
1213
1280
  @dataclass
1214
1281
  class Feature:
1215
- """Feature for model version."""
1282
+ full_name: str
1283
+ """The full three-part name (catalog, schema, name) of the feature."""
1216
1284
 
1217
- feature_name: Optional[str] = None
1218
- """Feature name"""
1285
+ source: DataSource
1286
+ """The data source of the feature."""
1219
1287
 
1220
- feature_table_id: Optional[str] = None
1221
- """Feature table id"""
1288
+ inputs: List[str]
1289
+ """The input columns from which the feature is computed."""
1222
1290
 
1223
- feature_table_name: Optional[str] = None
1224
- """Feature table name"""
1291
+ function: Function
1292
+ """The function by which the feature is computed."""
1293
+
1294
+ time_window: TimeWindow
1295
+ """The time window in which the feature is computed."""
1296
+
1297
+ description: Optional[str] = None
1298
+ """The description of the feature."""
1225
1299
 
1226
1300
  def as_dict(self) -> dict:
1227
1301
  """Serializes the Feature into a dictionary suitable for use as a JSON request body."""
1228
1302
  body = {}
1229
- if self.feature_name is not None:
1230
- body["feature_name"] = self.feature_name
1231
- if self.feature_table_id is not None:
1232
- body["feature_table_id"] = self.feature_table_id
1233
- if self.feature_table_name is not None:
1234
- body["feature_table_name"] = self.feature_table_name
1303
+ if self.description is not None:
1304
+ body["description"] = self.description
1305
+ if self.full_name is not None:
1306
+ body["full_name"] = self.full_name
1307
+ if self.function:
1308
+ body["function"] = self.function.as_dict()
1309
+ if self.inputs:
1310
+ body["inputs"] = [v for v in self.inputs]
1311
+ if self.source:
1312
+ body["source"] = self.source.as_dict()
1313
+ if self.time_window:
1314
+ body["time_window"] = self.time_window.as_dict()
1235
1315
  return body
1236
1316
 
1237
1317
  def as_shallow_dict(self) -> dict:
1238
1318
  """Serializes the Feature into a shallow dictionary of its immediate attributes."""
1239
1319
  body = {}
1240
- if self.feature_name is not None:
1241
- body["feature_name"] = self.feature_name
1242
- if self.feature_table_id is not None:
1243
- body["feature_table_id"] = self.feature_table_id
1244
- if self.feature_table_name is not None:
1245
- body["feature_table_name"] = self.feature_table_name
1320
+ if self.description is not None:
1321
+ body["description"] = self.description
1322
+ if self.full_name is not None:
1323
+ body["full_name"] = self.full_name
1324
+ if self.function:
1325
+ body["function"] = self.function
1326
+ if self.inputs:
1327
+ body["inputs"] = self.inputs
1328
+ if self.source:
1329
+ body["source"] = self.source
1330
+ if self.time_window:
1331
+ body["time_window"] = self.time_window
1246
1332
  return body
1247
1333
 
1248
1334
  @classmethod
1249
1335
  def from_dict(cls, d: Dict[str, Any]) -> Feature:
1250
1336
  """Deserializes the Feature from a dictionary."""
1251
1337
  return cls(
1252
- feature_name=d.get("feature_name", None),
1253
- feature_table_id=d.get("feature_table_id", None),
1254
- feature_table_name=d.get("feature_table_name", None),
1338
+ description=d.get("description", None),
1339
+ full_name=d.get("full_name", None),
1340
+ function=_from_dict(d, "function", Function),
1341
+ inputs=d.get("inputs", None),
1342
+ source=_from_dict(d, "source", DataSource),
1343
+ time_window=_from_dict(d, "time_window", TimeWindow),
1255
1344
  )
1256
1345
 
1257
1346
 
@@ -1391,7 +1480,7 @@ class FeatureLineageOnlineFeature:
1391
1480
  class FeatureList:
1392
1481
  """Feature list wrap all the features for a model version"""
1393
1482
 
1394
- features: Optional[List[Feature]] = None
1483
+ features: Optional[List[LinkedFeature]] = None
1395
1484
 
1396
1485
  def as_dict(self) -> dict:
1397
1486
  """Serializes the FeatureList into a dictionary suitable for use as a JSON request body."""
@@ -1410,7 +1499,7 @@ class FeatureList:
1410
1499
  @classmethod
1411
1500
  def from_dict(cls, d: Dict[str, Any]) -> FeatureList:
1412
1501
  """Deserializes the FeatureList from a dictionary."""
1413
- return cls(features=_repeated_dict(d, "features", Feature))
1502
+ return cls(features=_repeated_dict(d, "features", LinkedFeature))
1414
1503
 
1415
1504
 
1416
1505
  @dataclass
@@ -1565,6 +1654,90 @@ class ForecastingExperimentState(Enum):
1565
1654
  SUCCEEDED = "SUCCEEDED"
1566
1655
 
1567
1656
 
1657
+ @dataclass
1658
+ class Function:
1659
+ function_type: FunctionFunctionType
1660
+ """The type of the function."""
1661
+
1662
+ extra_parameters: Optional[List[FunctionExtraParameter]] = None
1663
+ """Extra parameters for parameterized functions."""
1664
+
1665
+ def as_dict(self) -> dict:
1666
+ """Serializes the Function into a dictionary suitable for use as a JSON request body."""
1667
+ body = {}
1668
+ if self.extra_parameters:
1669
+ body["extra_parameters"] = [v.as_dict() for v in self.extra_parameters]
1670
+ if self.function_type is not None:
1671
+ body["function_type"] = self.function_type.value
1672
+ return body
1673
+
1674
+ def as_shallow_dict(self) -> dict:
1675
+ """Serializes the Function into a shallow dictionary of its immediate attributes."""
1676
+ body = {}
1677
+ if self.extra_parameters:
1678
+ body["extra_parameters"] = self.extra_parameters
1679
+ if self.function_type is not None:
1680
+ body["function_type"] = self.function_type
1681
+ return body
1682
+
1683
+ @classmethod
1684
+ def from_dict(cls, d: Dict[str, Any]) -> Function:
1685
+ """Deserializes the Function from a dictionary."""
1686
+ return cls(
1687
+ extra_parameters=_repeated_dict(d, "extra_parameters", FunctionExtraParameter),
1688
+ function_type=_enum(d, "function_type", FunctionFunctionType),
1689
+ )
1690
+
1691
+
1692
+ @dataclass
1693
+ class FunctionExtraParameter:
1694
+ key: str
1695
+ """The name of the parameter."""
1696
+
1697
+ value: str
1698
+ """The value of the parameter."""
1699
+
1700
+ def as_dict(self) -> dict:
1701
+ """Serializes the FunctionExtraParameter into a dictionary suitable for use as a JSON request body."""
1702
+ body = {}
1703
+ if self.key is not None:
1704
+ body["key"] = self.key
1705
+ if self.value is not None:
1706
+ body["value"] = self.value
1707
+ return body
1708
+
1709
+ def as_shallow_dict(self) -> dict:
1710
+ """Serializes the FunctionExtraParameter into a shallow dictionary of its immediate attributes."""
1711
+ body = {}
1712
+ if self.key is not None:
1713
+ body["key"] = self.key
1714
+ if self.value is not None:
1715
+ body["value"] = self.value
1716
+ return body
1717
+
1718
+ @classmethod
1719
+ def from_dict(cls, d: Dict[str, Any]) -> FunctionExtraParameter:
1720
+ """Deserializes the FunctionExtraParameter from a dictionary."""
1721
+ return cls(key=d.get("key", None), value=d.get("value", None))
1722
+
1723
+
1724
+ class FunctionFunctionType(Enum):
1725
+
1726
+ APPROX_COUNT_DISTINCT = "APPROX_COUNT_DISTINCT"
1727
+ APPROX_PERCENTILE = "APPROX_PERCENTILE"
1728
+ AVG = "AVG"
1729
+ COUNT = "COUNT"
1730
+ FIRST = "FIRST"
1731
+ LAST = "LAST"
1732
+ MAX = "MAX"
1733
+ MIN = "MIN"
1734
+ STDDEV_POP = "STDDEV_POP"
1735
+ STDDEV_SAMP = "STDDEV_SAMP"
1736
+ SUM = "SUM"
1737
+ VAR_POP = "VAR_POP"
1738
+ VAR_SAMP = "VAR_SAMP"
1739
+
1740
+
1568
1741
  @dataclass
1569
1742
  class GetExperimentByNameResponse:
1570
1743
  experiment: Optional[Experiment] = None
@@ -2054,6 +2227,51 @@ class JobSpecWithoutSecret:
2054
2227
  return cls(job_id=d.get("job_id", None), workspace_url=d.get("workspace_url", None))
2055
2228
 
2056
2229
 
2230
+ @dataclass
2231
+ class LinkedFeature:
2232
+ """Feature for model version. ([ML-57150] Renamed from Feature to LinkedFeature)"""
2233
+
2234
+ feature_name: Optional[str] = None
2235
+ """Feature name"""
2236
+
2237
+ feature_table_id: Optional[str] = None
2238
+ """Feature table id"""
2239
+
2240
+ feature_table_name: Optional[str] = None
2241
+ """Feature table name"""
2242
+
2243
+ def as_dict(self) -> dict:
2244
+ """Serializes the LinkedFeature into a dictionary suitable for use as a JSON request body."""
2245
+ body = {}
2246
+ if self.feature_name is not None:
2247
+ body["feature_name"] = self.feature_name
2248
+ if self.feature_table_id is not None:
2249
+ body["feature_table_id"] = self.feature_table_id
2250
+ if self.feature_table_name is not None:
2251
+ body["feature_table_name"] = self.feature_table_name
2252
+ return body
2253
+
2254
+ def as_shallow_dict(self) -> dict:
2255
+ """Serializes the LinkedFeature into a shallow dictionary of its immediate attributes."""
2256
+ body = {}
2257
+ if self.feature_name is not None:
2258
+ body["feature_name"] = self.feature_name
2259
+ if self.feature_table_id is not None:
2260
+ body["feature_table_id"] = self.feature_table_id
2261
+ if self.feature_table_name is not None:
2262
+ body["feature_table_name"] = self.feature_table_name
2263
+ return body
2264
+
2265
+ @classmethod
2266
+ def from_dict(cls, d: Dict[str, Any]) -> LinkedFeature:
2267
+ """Deserializes the LinkedFeature from a dictionary."""
2268
+ return cls(
2269
+ feature_name=d.get("feature_name", None),
2270
+ feature_table_id=d.get("feature_table_id", None),
2271
+ feature_table_name=d.get("feature_table_name", None),
2272
+ )
2273
+
2274
+
2057
2275
  @dataclass
2058
2276
  class ListArtifactsResponse:
2059
2277
  files: Optional[List[FileInfo]] = None
@@ -2167,6 +2385,38 @@ class ListFeatureTagsResponse:
2167
2385
  )
2168
2386
 
2169
2387
 
2388
+ @dataclass
2389
+ class ListFeaturesResponse:
2390
+ features: Optional[List[Feature]] = None
2391
+ """List of features."""
2392
+
2393
+ next_page_token: Optional[str] = None
2394
+ """Pagination token to request the next page of results for this query."""
2395
+
2396
+ def as_dict(self) -> dict:
2397
+ """Serializes the ListFeaturesResponse into a dictionary suitable for use as a JSON request body."""
2398
+ body = {}
2399
+ if self.features:
2400
+ body["features"] = [v.as_dict() for v in self.features]
2401
+ if self.next_page_token is not None:
2402
+ body["next_page_token"] = self.next_page_token
2403
+ return body
2404
+
2405
+ def as_shallow_dict(self) -> dict:
2406
+ """Serializes the ListFeaturesResponse into a shallow dictionary of its immediate attributes."""
2407
+ body = {}
2408
+ if self.features:
2409
+ body["features"] = self.features
2410
+ if self.next_page_token is not None:
2411
+ body["next_page_token"] = self.next_page_token
2412
+ return body
2413
+
2414
+ @classmethod
2415
+ def from_dict(cls, d: Dict[str, Any]) -> ListFeaturesResponse:
2416
+ """Deserializes the ListFeaturesResponse from a dictionary."""
2417
+ return cls(features=_repeated_dict(d, "features", Feature), next_page_token=d.get("next_page_token", None))
2418
+
2419
+
2170
2420
  @dataclass
2171
2421
  class ListModelsResponse:
2172
2422
  next_page_token: Optional[str] = None
@@ -4734,6 +4984,38 @@ class TestRegistryWebhookResponse:
4734
4984
  return cls(body=d.get("body", None), status_code=d.get("status_code", None))
4735
4985
 
4736
4986
 
4987
+ @dataclass
4988
+ class TimeWindow:
4989
+ duration: str
4990
+ """The duration of the time window."""
4991
+
4992
+ offset: Optional[str] = None
4993
+ """The offset of the time window."""
4994
+
4995
+ def as_dict(self) -> dict:
4996
+ """Serializes the TimeWindow into a dictionary suitable for use as a JSON request body."""
4997
+ body = {}
4998
+ if self.duration is not None:
4999
+ body["duration"] = self.duration
5000
+ if self.offset is not None:
5001
+ body["offset"] = self.offset
5002
+ return body
5003
+
5004
+ def as_shallow_dict(self) -> dict:
5005
+ """Serializes the TimeWindow into a shallow dictionary of its immediate attributes."""
5006
+ body = {}
5007
+ if self.duration is not None:
5008
+ body["duration"] = self.duration
5009
+ if self.offset is not None:
5010
+ body["offset"] = self.offset
5011
+ return body
5012
+
5013
+ @classmethod
5014
+ def from_dict(cls, d: Dict[str, Any]) -> TimeWindow:
5015
+ """Deserializes the TimeWindow from a dictionary."""
5016
+ return cls(duration=d.get("duration", None), offset=d.get("offset", None))
5017
+
5018
+
4737
5019
  @dataclass
4738
5020
  class TransitionRequest:
4739
5021
  """For activities, this contains the activity recorded for the action. For comments, this contains
@@ -6256,6 +6538,116 @@ class ExperimentsAPI:
6256
6538
  return UpdateRunResponse.from_dict(res)
6257
6539
 
6258
6540
 
6541
+ class FeatureEngineeringAPI:
6542
+ """[description]"""
6543
+
6544
+ def __init__(self, api_client):
6545
+ self._api = api_client
6546
+
6547
+ def create_feature(self, feature: Feature) -> Feature:
6548
+ """Create a Feature.
6549
+
6550
+ :param feature: :class:`Feature`
6551
+ Feature to create.
6552
+
6553
+ :returns: :class:`Feature`
6554
+ """
6555
+ body = feature.as_dict()
6556
+ headers = {
6557
+ "Accept": "application/json",
6558
+ "Content-Type": "application/json",
6559
+ }
6560
+
6561
+ res = self._api.do("POST", "/api/2.0/feature-engineering/features", body=body, headers=headers)
6562
+ return Feature.from_dict(res)
6563
+
6564
+ def delete_feature(self, full_name: str):
6565
+ """Delete a Feature.
6566
+
6567
+ :param full_name: str
6568
+ Name of the feature to delete.
6569
+
6570
+
6571
+ """
6572
+
6573
+ headers = {
6574
+ "Accept": "application/json",
6575
+ }
6576
+
6577
+ self._api.do("DELETE", f"/api/2.0/feature-engineering/features/{full_name}", headers=headers)
6578
+
6579
+ def get_feature(self, full_name: str) -> Feature:
6580
+ """Get a Feature.
6581
+
6582
+ :param full_name: str
6583
+ Name of the feature to get.
6584
+
6585
+ :returns: :class:`Feature`
6586
+ """
6587
+
6588
+ headers = {
6589
+ "Accept": "application/json",
6590
+ }
6591
+
6592
+ res = self._api.do("GET", f"/api/2.0/feature-engineering/features/{full_name}", headers=headers)
6593
+ return Feature.from_dict(res)
6594
+
6595
+ def list_features(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[Feature]:
6596
+ """List Features.
6597
+
6598
+ :param page_size: int (optional)
6599
+ The maximum number of results to return.
6600
+ :param page_token: str (optional)
6601
+ Pagination token to go to the next page based on a previous query.
6602
+
6603
+ :returns: Iterator over :class:`Feature`
6604
+ """
6605
+
6606
+ query = {}
6607
+ if page_size is not None:
6608
+ query["page_size"] = page_size
6609
+ if page_token is not None:
6610
+ query["page_token"] = page_token
6611
+ headers = {
6612
+ "Accept": "application/json",
6613
+ }
6614
+
6615
+ while True:
6616
+ json = self._api.do("GET", "/api/2.0/feature-engineering/features", query=query, headers=headers)
6617
+ if "features" in json:
6618
+ for v in json["features"]:
6619
+ yield Feature.from_dict(v)
6620
+ if "next_page_token" not in json or not json["next_page_token"]:
6621
+ return
6622
+ query["page_token"] = json["next_page_token"]
6623
+
6624
+ def update_feature(self, full_name: str, feature: Feature, update_mask: str) -> Feature:
6625
+ """Update a Feature.
6626
+
6627
+ :param full_name: str
6628
+ The full three-part name (catalog, schema, name) of the feature.
6629
+ :param feature: :class:`Feature`
6630
+ Feature to update.
6631
+ :param update_mask: str
6632
+ The list of fields to update.
6633
+
6634
+ :returns: :class:`Feature`
6635
+ """
6636
+ body = feature.as_dict()
6637
+ query = {}
6638
+ if update_mask is not None:
6639
+ query["update_mask"] = update_mask
6640
+ headers = {
6641
+ "Accept": "application/json",
6642
+ "Content-Type": "application/json",
6643
+ }
6644
+
6645
+ res = self._api.do(
6646
+ "PATCH", f"/api/2.0/feature-engineering/features/{full_name}", query=query, body=body, headers=headers
6647
+ )
6648
+ return Feature.from_dict(res)
6649
+
6650
+
6259
6651
  class FeatureStoreAPI:
6260
6652
  """A feature store is a centralized repository that enables data scientists to find and share features. Using
6261
6653
  a feature store also ensures that the code used to compute feature values is the same during model
@@ -232,11 +232,11 @@ class FederationPolicy:
232
232
  oidc_policy: Optional[OidcFederationPolicy] = None
233
233
 
234
234
  policy_id: Optional[str] = None
235
- """The ID of the federation policy."""
235
+ """The ID of the federation policy. Output only."""
236
236
 
237
237
  service_principal_id: Optional[int] = None
238
- """The service principal ID that this federation policy applies to. Only set for service principal
239
- federation policies."""
238
+ """The service principal ID that this federation policy applies to. Output only. Only set for
239
+ service principal federation policies."""
240
240
 
241
241
  uid: Optional[str] = None
242
242
  """Unique, immutable id of the federation policy."""