user
07/18/2022, 4:32 PMuser
07/18/2022, 4:58 PMuser
07/18/2022, 5:03 PMuser
07/18/2022, 5:07 PMfiles = get_all_files_list("./datasets/input-1", "*")
client = init_client()
repo = 'repo-1'
branch = 'develop'
diff = upload(files, client, "repo-1", "develop")
print(diff)
commit_result = commit(client, 'repo-1', 'develop', 'no files should change ?')
print(commit_result)
the console result
[] --- > print(diff)
{'committer': 'admin',
'creation_date': 1658163909,
'id': '18766368e6fb24a4cf91fdef13f18551de2d0c1850b2fa653895fb795d4b343e',
'message': 'no files should change ?',
'meta_range_id': '',
'metadata': {'using': 'python_api'},
'parents': ['7f245c5efa55ae9fb71489d8ddc398b9af94bc27488522c29d1177e72423b0ad']} ----> print(commit_result)
Upload method snippet :
def upload(files: list, client: LakeFSClient, repo: str, branch: str):
for f in files:
with open(f,'rb') as stream:
client.objects.upload_object(repository=repo, branch=branch, path=f, content=stream )
return client.branches.diff_branch(repository=repo, branch=branch).results
commit method snippet:
def commit(client: LakeFSClient, repo, branch, message):
commit_creation = models.CommitCreation(message=message, metadata={'using': 'python_api'})
return client.commits.commit(
repository=repo,
branch=branch,
commit_creation=commit_creation,
)
user
07/18/2022, 5:12 PMuser
07/18/2022, 5:49 PMuser
07/18/2022, 5:50 PMfor f in files:
with open(f,'rb') as stream:
client.objects.upload_object(repository=repo, branch=branch, path=f, content=stream )
return client.branches.diff_branch(repository=repo, branch=branch).results
this guy right ?user
07/18/2022, 5:50 PMuser
07/18/2022, 6:07 PMdiff_branch
command.
Hope it makes sense.user
07/18/2022, 6:11 PMuser
07/18/2022, 6:15 PMuser
07/18/2022, 6:27 PMuser
07/18/2022, 6:28 PMref_1 = "05bc970748c06490ef9fc3c9571d1164ffb846a4d8d933be547ee3c7fdf7ea44"
ref_2 = "99eaf85194401e3e948f32f66a244e1ef1667becc56271a59f115c11bae20b80"
diff = client.refs.diff_refs(repo, ref_2, ref_1)
this workeduser
07/18/2022, 6:29 PM