Ariel Shaqed (Scolnicov)
05/29/2022, 9:33 AMlakefs_client~=0.41.0
) to upload to lakeFS. Since I don't have a file, I want to use a Pythonic IO. But I get:
Traceback (most recent call last):
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_provider/operators/upload_operator.py", line 50, in execute
ref = hook.upload(self.repo, self.branch, self.path, self.content)
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_provider/hooks/lakefs_hook.py", line 62, in upload
upload = client.objects.upload_object(
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_client/api_client.py", line 772, in __call__
return self.callable(self, *args, **kwargs)
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_client/api/objects_api.py", line 990, in __upload_object
return self.call_with_http_info(**kwargs)
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_client/api_client.py", line 834, in call_with_http_info
return self.api_client.call_api(
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_client/api_client.py", line 409, in call_api
return self.__call_api(resource_path, method,
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_client/api_client.py", line 174, in __call_api
post_params.extend(self.files_parameters(files))
File "/home/ariels/dev/airflow-provider-lakeFS/env/lib/python3.10/site-packages/lakefs_client/api_client.py", line 551, in files_parameters
filename = os.path.basename(file_instance.name)
AttributeError: '_io.StringIO' object has no attribute 'name'
Any idea why it wants to know the name of a file, when I am anyway specifying the desired destination name? And: is there anything other than a file that I could pass it?Niro
05/29/2022, 2:59 PMAriel Shaqed (Scolnicov)
05/29/2022, 3:00 PMStringIO
. Eventually @Barak Amar helped me figure out that I can create a NameStringIO
-- a StringIO
with a name
field. And Swagger / OpenAPI actually wants the contents in a mime part with the name "contents". So once I set name='contents'
on my NameStringIO
it all works.Ariel Shaqed (Scolnicov)
05/29/2022, 3:00 PMNiro
05/29/2022, 3:01 PMAriel Shaqed (Scolnicov)
05/29/2022, 3:02 PM