Giuseppe Barbieri
03/04/2024, 8:55 AMobj = lakefs.WriteableObject(repository_id=repo.properties.id, reference_id="main", path=path, client=clt).upload(
data=data, metadata=metadata)
which, in turn, shall call thisGiuseppe Barbieri
03/04/2024, 8:56 AMval repo = setupRepo()
val branch = "main"
val file = tempFile.apply { writeText("test_data") }
val path = "test_obj"
val metadata = mapOf("foo" to "bar")
val headers = mapOf("Accept" to "application/json",
"Content-Type" to "application/octet-stream") + metadata.mapKeys { (k, _) -> "$LAKEFS_METADATA_PREFIX$k" }
val resourcePath = "/repositories/${repo.id}/branches/$branch/objects"
val queryParams = URI(hashMapOf("path" to path).encode())
testClient.updateParamsForAuth(arrayOf("basic_auth"), null, headers, null, resourcePath, "POST", queryParams)
val stats = testClient.objectsApi.uploadObject(repo.properties!!.id, branch, path).content(file).execute()
assert(stats.path == path)
assert(stats.mtime <= System.currentTimeMillis())
assert(stats.sizeBytes!! == file.length())
println(stats.metadata)
// assert(stats.metadata == metadata)
assert(stats.contentType == "application/octet-stream")
but stats.metadata
is still empty..
headers
is {Accept=application/json, Content-Type=application/octet-stream, x-lakefs-meta-foo=bar}
queryParams
is ?path=test_obj
the returning stats
is
class ObjectStats {
path: test_obj
pathType: object
physicalAddress: local:///home/elect/lakefs/data/block/tmp/junit15669663127659863511/data/ghkntbipdakrls40rqlg/cnios1ipdakrls40rqr0
physicalAddressExpiry: null
checksum: 6af8307c2460f2d208ad254f04be4b0d
sizeBytes: 9
mtime: 1709542918
metadata: {}
contentType: application/octet-stream
additionalProperties: null
}
Giuseppe Barbieri
03/04/2024, 8:56 AMNiro
03/04/2024, 9:16 AMGiuseppe Barbieri
03/04/2024, 9:17 AM"io.lakefs:sdk:1.11.0"
Giuseppe Barbieri
03/04/2024, 9:17 AMNiro
03/04/2024, 9:18 AMGiuseppe Barbieri
03/04/2024, 9:18 AMGiuseppe Barbieri
03/04/2024, 9:19 AMNiro
03/04/2024, 9:19 AMI'm trying to upload metadata with an object, but I'm having issues on the jvm side
the python wrapper is the following
Niro
03/04/2024, 9:20 AMGiuseppe Barbieri
03/04/2024, 9:20 AMNiro
03/04/2024, 9:21 AMNiro
03/04/2024, 9:22 AMGiuseppe Barbieri
03/04/2024, 9:22 AMGiuseppe Barbieri
03/04/2024, 9:23 AMThe Python wrapper has explicit code which makes this happen.isn't this one?
Niro
03/04/2024, 9:28 AMGiuseppe Barbieri
03/04/2024, 9:30 AMGet/SetPhysicalAddress
methods to upload the metadata? How?Giuseppe Barbieri
03/04/2024, 9:30 AMGiuseppe Barbieri
03/04/2024, 9:30 AMNiro
03/04/2024, 9:31 AMGiuseppe Barbieri
03/04/2024, 9:31 AMGiuseppe Barbieri
03/04/2024, 9:32 AMval storageNamespace by lazy { "local:/$tempFolder" }
Niro
03/04/2024, 9:40 AMGiuseppe Barbieri
03/04/2024, 9:40 AMuser_metadata
, thanks