Using TREST how to upload local csv file to azure blob.

Four Stars

Using TREST how to upload local csv file to azure blob.

Hi,

 

Could someone please suggest how to upload local file saved in a network drive to Azure blob?  I cannot use tfilefetch because of file is saved in the local drive and upload to Azure blob.  It works in reverse.  Fetching file from blob and dropping it to local drive.  Tried TREST component and it only saves the header and not the file content.  I am not able to make below code work that provided as a solution for TREST.

 

OkHttpClient client = new OkHttpClient();
File sourceFile = new File("C:drive/text.csv");
MediaType mediaType = MediaType.parse("multipart/form-data");
RequestBody body = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("file", "C:drive/text.csv",RequestBody.create(MediaType.parse("/csv"), sourceFile) )
.addFormDataPart("objectName", "project")
.addFormDataPart("objectProperty", "documents")
.addFormDataPart("objectId", context.newProjectId)
.build();
Request request = new Request.Builder()
.url("https://azur")
.post(body)
.addHeader("content-type", "application/csv")
.addHeader("cache-control", "no-cache")
.build();
Response response = client.newCall(request).execute();
String json = response.body().string();
System.out.println(json.toString());

 

Please help.

 

Thanks,

pk

Four Stars

Re: Using TREST how to upload local csv file to azure blob.

Anybody??

 

Is there an http web service put component that can be used to load csv file to an external location?  We cannot use storageblob component for this solution.

 

Thanks,

Quest

Nine Stars

Re: Using TREST how to upload local csv file to azure blob.

How about tAzureStoragePut? This component does put files from Local Folder to Azure Storage (container/blobs).
Four Stars

Re: Using TREST how to upload local csv file to azure blob.

Hi Abhishek,

 

Sorry for the late response. No, I cannot use tAzureStoragePut.  I have to either use trestclient or trest.  I tried trest and it only saves header.  thttprequest works but now thrown error of 413 error code.  It worked sometimes when files are smaller. I cannot use tfilefetch, it only works in reverse.  I need to fetch a file from local drive and drop to Azure. Any suggestions?

 

Thanks!

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now