Skip to content

Commit 9f35f74

Browse files
authored
Initialize Foundry CLI Prototype (#8)
1 parent 9f234ad commit 9f35f74

File tree

17 files changed

+1902
-88
lines changed

17 files changed

+1902
-88
lines changed

changelog/@unreleased/pr-8.v2.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type: feature
2+
feature:
3+
description: Foundry CLI Prototype
4+
links:
5+
- https://github.com/palantir/foundry-platform-python/pull/8

docs/namespaces/Datasets/Branch.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,10 @@ page_size = None
220220

221221

222222
try:
223-
for branch in foundry_client.datasets.Dataset.Branch.list(dataset_rid, page_size=page_size):
223+
for branch in foundry_client.datasets.Dataset.Branch.list(
224+
dataset_rid,
225+
page_size=page_size,
226+
):
224227
pprint(branch)
225228
except PalantirRPCException as e:
226229
print("HTTP error when calling Branch.list: %s\n" % e)
@@ -264,7 +267,9 @@ from foundry import FoundryClient
264267
from foundry import PalantirRPCException
265268
from pprint import pprint
266269

267-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
270+
foundry_client = FoundryClient(
271+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
272+
)
268273

269274
# DatasetRid | datasetRid
270275
dataset_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da"
@@ -276,9 +281,12 @@ page_size = None
276281
page_token = None
277282

278283

279-
280284
try:
281-
api_response = foundry_client.datasets.Dataset.Branch.page(dataset_rid,page_size=page_sizepage_token=page_token)
285+
api_response = foundry_client.datasets.Dataset.Branch.page(
286+
dataset_rid,
287+
page_size=page_size,
288+
page_token=page_token,
289+
)
282290
print("The page response:\n")
283291
pprint(api_response)
284292
except PalantirRPCException as e:

docs/namespaces/Datasets/Dataset.md

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ from foundry import FoundryClient
8989
from foundry import PalantirRPCException
9090
from pprint import pprint
9191

92-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
92+
foundry_client = FoundryClient(
93+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
94+
)
9395

9496
# DatasetRid | datasetRid
9597
dataset_rid = None
@@ -104,9 +106,13 @@ preview = true
104106
transaction_rid = None
105107

106108

107-
108109
try:
109-
api_response = foundry_client.datasets.Dataset.delete_schema(dataset_rid,branch_id=branch_idpreview=previewtransaction_rid=transaction_rid)
110+
api_response = foundry_client.datasets.Dataset.delete_schema(
111+
dataset_rid,
112+
branch_id=branch_id,
113+
preview=preview,
114+
transaction_rid=transaction_rid,
115+
)
110116
print("The delete_schema response:\n")
111117
pprint(api_response)
112118
except PalantirRPCException as e:
@@ -204,7 +210,9 @@ from foundry import FoundryClient
204210
from foundry import PalantirRPCException
205211
from pprint import pprint
206212

207-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
213+
foundry_client = FoundryClient(
214+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
215+
)
208216

209217
# DatasetRid | datasetRid
210218
dataset_rid = None
@@ -219,9 +227,13 @@ preview = true
219227
transaction_rid = None
220228

221229

222-
223230
try:
224-
api_response = foundry_client.datasets.Dataset.get_schema(dataset_rid,branch_id=branch_idpreview=previewtransaction_rid=transaction_rid)
231+
api_response = foundry_client.datasets.Dataset.get_schema(
232+
dataset_rid,
233+
branch_id=branch_id,
234+
preview=preview,
235+
transaction_rid=transaction_rid,
236+
)
225237
print("The get_schema response:\n")
226238
pprint(api_response)
227239
except PalantirRPCException as e:
@@ -272,7 +284,9 @@ from foundry import FoundryClient
272284
from foundry import PalantirRPCException
273285
from pprint import pprint
274286

275-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
287+
foundry_client = FoundryClient(
288+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
289+
)
276290

277291
# DatasetRid | datasetRid
278292
dataset_rid = None
@@ -296,9 +310,16 @@ row_limit = None
296310
start_transaction_rid = None
297311

298312

299-
300313
try:
301-
api_response = foundry_client.datasets.Dataset.read(dataset_rid,columns=columnsformat=formatbranch_id=branch_idend_transaction_rid=end_transaction_ridrow_limit=row_limitstart_transaction_rid=start_transaction_rid)
314+
api_response = foundry_client.datasets.Dataset.read(
315+
dataset_rid,
316+
columns=columns,
317+
format=format,
318+
branch_id=branch_id,
319+
end_transaction_rid=end_transaction_rid,
320+
row_limit=row_limit,
321+
start_transaction_rid=start_transaction_rid,
322+
)
302323
print("The read response:\n")
303324
pprint(api_response)
304325
except PalantirRPCException as e:
@@ -399,7 +420,9 @@ from foundry import FoundryClient
399420
from foundry import PalantirRPCException
400421
from pprint import pprint
401422

402-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
423+
foundry_client = FoundryClient(
424+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
425+
)
403426

404427
# DatasetRid | datasetRid
405428
dataset_rid = None
@@ -414,9 +437,13 @@ branch_id = None
414437
preview = true
415438

416439

417-
418440
try:
419-
api_response = foundry_client.datasets.Dataset.replace_schema(dataset_rid,body,branch_id=branch_idpreview=preview)
441+
api_response = foundry_client.datasets.Dataset.replace_schema(
442+
dataset_rid,
443+
body,
444+
branch_id=branch_id,
445+
preview=preview,
446+
)
420447
print("The replace_schema response:\n")
421448
pprint(api_response)
422449
except PalantirRPCException as e:

docs/namespaces/Datasets/File.md

Lines changed: 61 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ from foundry import FoundryClient
4747
from foundry import PalantirRPCException
4848
from pprint import pprint
4949

50-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
50+
foundry_client = FoundryClient(
51+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
52+
)
5153

5254
# DatasetRid | datasetRid
5355
dataset_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da"
@@ -62,9 +64,13 @@ branch_id = None
6264
transaction_rid = None
6365

6466

65-
6667
try:
67-
api_response = foundry_client.datasets.File.delete(dataset_rid,file_path,branch_id=branch_idtransaction_rid=transaction_rid)
68+
api_response = foundry_client.datasets.Dataset.File.delete(
69+
dataset_rid,
70+
file_path,
71+
branch_id=branch_id,
72+
transaction_rid=transaction_rid,
73+
)
6874
print("The delete response:\n")
6975
pprint(api_response)
7076
except PalantirRPCException as e:
@@ -132,7 +138,9 @@ from foundry import FoundryClient
132138
from foundry import PalantirRPCException
133139
from pprint import pprint
134140

135-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
141+
foundry_client = FoundryClient(
142+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
143+
)
136144

137145
# DatasetRid | datasetRid
138146
dataset_rid = "ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da"
@@ -150,9 +158,14 @@ end_transaction_rid = None
150158
start_transaction_rid = None
151159

152160

153-
154161
try:
155-
api_response = foundry_client.datasets.File.get(dataset_rid,file_path,branch_id=branch_idend_transaction_rid=end_transaction_ridstart_transaction_rid=start_transaction_rid)
162+
api_response = foundry_client.datasets.Dataset.File.get(
163+
dataset_rid,
164+
file_path,
165+
branch_id=branch_id,
166+
end_transaction_rid=end_transaction_rid,
167+
start_transaction_rid=start_transaction_rid,
168+
)
156169
print("The get response:\n")
157170
pprint(api_response)
158171
except PalantirRPCException as e:
@@ -222,7 +235,9 @@ from foundry import FoundryClient
222235
from foundry import PalantirRPCException
223236
from pprint import pprint
224237

225-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
238+
foundry_client = FoundryClient(
239+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
240+
)
226241

227242
# DatasetRid | datasetRid
228243
dataset_rid = None
@@ -240,9 +255,14 @@ page_size = None
240255
start_transaction_rid = None
241256

242257

243-
244258
try:
245-
for file in foundry_client.datasets.File.list(dataset_rid,branch_id=branch_idend_transaction_rid=end_transaction_ridpage_size=page_sizestart_transaction_rid=start_transaction_rid):
259+
for file in foundry_client.datasets.Dataset.File.list(
260+
dataset_rid,
261+
branch_id=branch_id,
262+
end_transaction_rid=end_transaction_rid,
263+
page_size=page_size,
264+
start_transaction_rid=start_transaction_rid,
265+
):
246266
pprint(file)
247267
except PalantirRPCException as e:
248268
print("HTTP error when calling File.list: %s\n" % e)
@@ -332,7 +352,9 @@ from foundry import FoundryClient
332352
from foundry import PalantirRPCException
333353
from pprint import pprint
334354

335-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
355+
foundry_client = FoundryClient(
356+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
357+
)
336358

337359
# DatasetRid | datasetRid
338360
dataset_rid = None
@@ -353,9 +375,15 @@ page_token = None
353375
start_transaction_rid = None
354376

355377

356-
357378
try:
358-
api_response = foundry_client.datasets.File.page(dataset_rid,branch_id=branch_idend_transaction_rid=end_transaction_ridpage_size=page_sizepage_token=page_tokenstart_transaction_rid=start_transaction_rid)
379+
api_response = foundry_client.datasets.Dataset.File.page(
380+
dataset_rid,
381+
branch_id=branch_id,
382+
end_transaction_rid=end_transaction_rid,
383+
page_size=page_size,
384+
page_token=page_token,
385+
start_transaction_rid=start_transaction_rid,
386+
)
359387
print("The page response:\n")
360388
pprint(api_response)
361389
except PalantirRPCException as e:
@@ -424,7 +452,9 @@ from foundry import FoundryClient
424452
from foundry import PalantirRPCException
425453
from pprint import pprint
426454

427-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
455+
foundry_client = FoundryClient(
456+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
457+
)
428458

429459
# DatasetRid | datasetRid
430460
dataset_rid = None
@@ -442,9 +472,14 @@ end_transaction_rid = None
442472
start_transaction_rid = None
443473

444474

445-
446475
try:
447-
api_response = foundry_client.datasets.File.read(dataset_rid,file_path,branch_id=branch_idend_transaction_rid=end_transaction_ridstart_transaction_rid=start_transaction_rid)
476+
api_response = foundry_client.datasets.Dataset.File.read(
477+
dataset_rid,
478+
file_path,
479+
branch_id=branch_id,
480+
end_transaction_rid=end_transaction_rid,
481+
start_transaction_rid=start_transaction_rid,
482+
)
448483
print("The read response:\n")
449484
pprint(api_response)
450485
except PalantirRPCException as e:
@@ -509,7 +544,9 @@ from foundry import FoundryClient
509544
from foundry import PalantirRPCException
510545
from pprint import pprint
511546

512-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
547+
foundry_client = FoundryClient(
548+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
549+
)
513550

514551
# DatasetRid | datasetRid
515552
dataset_rid = None
@@ -530,9 +567,15 @@ transaction_rid = None
530567
transaction_type = None
531568

532569

533-
534570
try:
535-
api_response = foundry_client.datasets.File.upload(dataset_rid,body,file_path=file_pathbranch_id=branch_idtransaction_rid=transaction_ridtransaction_type=transaction_type)
571+
api_response = foundry_client.datasets.Dataset.File.upload(
572+
dataset_rid,
573+
body,
574+
file_path=file_path,
575+
branch_id=branch_id,
576+
transaction_rid=transaction_rid,
577+
transaction_type=transaction_type,
578+
)
536579
print("The upload response:\n")
537580
pprint(api_response)
538581
except PalantirRPCException as e:

docs/namespaces/Datasets/Transaction.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ branch_id = None
167167

168168
try:
169169
api_response = foundry_client.datasets.Dataset.Transaction.create(
170-
dataset_rid, create_transaction_request, branch_id=branch_id
170+
dataset_rid,
171+
create_transaction_request,
172+
branch_id=branch_id,
171173
)
172174
print("The create response:\n")
173175
pprint(api_response)

docs/namespaces/Ontologies/ActionType.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ page_size = None
104104

105105
try:
106106
for action_type in foundry_client.ontologies.Ontology.ActionType.list(
107-
ontology, page_size=page_size
107+
ontology,
108+
page_size=page_size,
108109
):
109110
pprint(action_type)
110111
except PalantirRPCException as e:
@@ -152,7 +153,9 @@ from foundry import FoundryClient
152153
from foundry import PalantirRPCException
153154
from pprint import pprint
154155

155-
foundry_client = FoundryClient(auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com")
156+
foundry_client = FoundryClient(
157+
auth=foundry.UserTokenAuth(...), hostname="example.palantirfoundry.com"
158+
)
156159

157160
# OntologyIdentifier | ontology
158161
ontology = "palantir"
@@ -164,9 +167,12 @@ page_size = None
164167
page_token = None
165168

166169

167-
168170
try:
169-
api_response = foundry_client.ontologies.Ontology.ActionType.page(ontology,page_size=page_sizepage_token=page_token)
171+
api_response = foundry_client.ontologies.Ontology.ActionType.page(
172+
ontology,
173+
page_size=page_size,
174+
page_token=page_token,
175+
)
170176
print("The page response:\n")
171177
pprint(api_response)
172178
except PalantirRPCException as e:

0 commit comments

Comments
 (0)