pltr-cli 0.9.0__py3-none-any.whl → 0.9.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.
pltr/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.9.0"
1
+ __version__ = "0.9.1"
pltr/services/dataset.py CHANGED
@@ -58,27 +58,55 @@ class DatasetService(BaseService):
58
58
 
59
59
  def apply_schema(self, dataset_rid: str, branch: str = "master") -> Dict[str, Any]:
60
60
  """
61
- Apply/infer schema for a dataset using the schema inference API.
61
+ Apply/infer schema for a dataset using both schema inference and metadata APIs.
62
+
63
+ This method performs two sequential API calls:
64
+ 1. Schema inference to infer the dataset schema
65
+ 2. Schema application to apply the inferred schema to the dataset
62
66
 
63
67
  Args:
64
68
  dataset_rid: Dataset Resource Identifier
65
69
  branch: Dataset branch name (default: "master")
66
70
 
67
71
  Returns:
68
- Schema inference result
72
+ Schema application result including transaction and version information
69
73
  """
70
74
  try:
71
- endpoint = f"/foundry-schema-inference/api/datasets/{dataset_rid}/branches/{branch}/schema"
72
- response = self._make_request("POST", endpoint, json_data={})
75
+ # Step 1: Call schema inference API to infer the schema
76
+ inference_endpoint = f"/foundry-schema-inference/api/datasets/{dataset_rid}/branches/{branch}/schema"
77
+ inference_response = self._make_request(
78
+ "POST", inference_endpoint, json_data={}
79
+ )
73
80
 
74
- # Parse the response
75
- result = response.json() if response.text else {}
81
+ # Parse the inference response
82
+ inference_result = (
83
+ inference_response.json() if inference_response.text else {}
84
+ )
85
+
86
+ # Extract the foundry schema from the inference result
87
+ foundry_schema = inference_result.get("data", {}).get("foundrySchema")
88
+ if not foundry_schema:
89
+ raise RuntimeError(
90
+ "Schema inference failed: No foundrySchema found in response"
91
+ )
92
+
93
+ # Step 2: Call foundry-metadata API to apply the schema
94
+ metadata_endpoint = f"/foundry-metadata/api/schemas/datasets/{dataset_rid}/branches/{branch}"
95
+ metadata_response = self._make_request(
96
+ "POST", metadata_endpoint, json_data=foundry_schema
97
+ )
98
+
99
+ # Parse the metadata response
100
+ metadata_result = metadata_response.json() if metadata_response.text else {}
76
101
 
77
102
  return {
78
103
  "dataset_rid": dataset_rid,
79
104
  "branch": branch,
80
105
  "status": "Schema applied successfully",
81
- "result": result,
106
+ "inference_result": inference_result,
107
+ "application_result": metadata_result,
108
+ "transaction_rid": metadata_result.get("transactionRid"),
109
+ "version_id": metadata_result.get("versionId"),
82
110
  }
83
111
  except Exception as e:
84
112
  raise RuntimeError(f"Failed to apply schema for dataset {dataset_rid}: {e}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pltr-cli
3
- Version: 0.9.0
3
+ Version: 0.9.1
4
4
  Summary: Command-line interface for Palantir Foundry APIs
5
5
  Project-URL: Homepage, https://github.com/anjor/pltr-cli
6
6
  Project-URL: Repository, https://github.com/anjor/pltr-cli
@@ -1,4 +1,4 @@
1
- pltr/__init__.py,sha256=H9NWRZb7NbeRRPLP_V1fARmLNXranorVM-OOY-8_2ug,22
1
+ pltr/__init__.py,sha256=UwJXM8JY2T3tE2id0K2k_lEaVThbRTrGO1mNibyzIz8,22
2
2
  pltr/__main__.py,sha256=HWJ49UoAYBQCf8kjuySPmBTuUjTZrOx-y6PzMTyS1KE,879
3
3
  pltr/cli.py,sha256=DikRsWsU7QWvRWHgB6wZIct916ebWyaub7PlAjKJXws,2664
4
4
  pltr/auth/__init__.py,sha256=G0V-Rh25FaJsH2nhrf146XQQG_ApdbyPJNuHJC25kgk,38
@@ -33,7 +33,7 @@ pltr/services/__init__.py,sha256=zQpgrqPdAkZI-nobi33mctU2-iGNgazzvjBVY8YRbSQ,101
33
33
  pltr/services/admin.py,sha256=8FjExmDeIKeVqkAxM83SVvpp_pH9W-Q33cgVs6BHxLQ,9957
34
34
  pltr/services/base.py,sha256=JF9cyYf7njZuj1ldOLdgzIDhJjOfazBvXPNR-gKVnMY,3682
35
35
  pltr/services/connectivity.py,sha256=34kazXhue5gNi1_2s2R5Ma4VQe6jP25CO-ztiPhCeZw,10548
36
- pltr/services/dataset.py,sha256=UuPJ11OryJZg2zUSRdtwJq_pj9unE24-mYGr5oBWobU,43602
36
+ pltr/services/dataset.py,sha256=LFoK8otJ_MYqH0x5rcmNyIi5X0zr_Q8KP-zG9reArPA,45027
37
37
  pltr/services/folder.py,sha256=mWElyvn-wXPB5sv8Ik_dLeW5JM6jZg3g9KKBk6UcrlQ,5389
38
38
  pltr/services/mediasets.py,sha256=HgHNFWoG9r-5xupANVOxHg_h5EKsBDl6PsO8hwdbm28,9854
39
39
  pltr/services/ontology.py,sha256=iW7qRK8ptlw-u4eAwLNC-mdzLoLZzh7SRqJyok2c3GU,14883
@@ -48,8 +48,8 @@ pltr/utils/alias_resolver.py,sha256=DIF7P1UnUU8kqocJfIDEWjYq4s8_0KfqRZBbECeZEh8,
48
48
  pltr/utils/completion.py,sha256=bjeqjleEfB2YcQFpcxvF0GoQ763F6KBbULSZC4FWY_g,4980
49
49
  pltr/utils/formatting.py,sha256=38g3G2T5WUFKCCKo42NIBR8_Rdl4pp0ytCEZURoV3l4,50275
50
50
  pltr/utils/progress.py,sha256=BKYbiLO61uhQbibabU7pxvvbAWMRLRmqk4pZldBQK_g,9053
51
- pltr_cli-0.9.0.dist-info/METADATA,sha256=Fddmpgwz08LfEHN4sjHymbv0a69Pi9Ss7hA7t-Oxx08,17714
52
- pltr_cli-0.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- pltr_cli-0.9.0.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
- pltr_cli-0.9.0.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
- pltr_cli-0.9.0.dist-info/RECORD,,
51
+ pltr_cli-0.9.1.dist-info/METADATA,sha256=xxIsV9YwPwzv799EzrHcDAqM44xCBmnHREtfy6E-0ek,17714
52
+ pltr_cli-0.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ pltr_cli-0.9.1.dist-info/entry_points.txt,sha256=8tvEcW04kA_oAE2Dwwu-Og9efjl4ESJvs4AzlP2KBdQ,38
54
+ pltr_cli-0.9.1.dist-info/licenses/LICENSE,sha256=6VUFd_ytnOBD2O1tmkKrA-smigi9QEhYr_tge4h4z8Y,1070
55
+ pltr_cli-0.9.1.dist-info/RECORD,,