Skip to main content
Solved

Read Features from .zip or .tar.gz

  • Jul 22, 2017 11:27 PM UTC
  • 5 replies
  • 193 views

Forum|alt.badge.img

Hi,

My customers upload .zip or .tar.gz files to our server, I have a CSV reader, when I set the url (https://mydomain.com/customer1.zip) of a zip file with only 1 file, FME server works fine.

Now, a customer send us .tar.gz files with several files in it, for this spacific workspace I need to grab only one file form the package, there is a way to specify which will be the file in the url to process? I tried with https://mydomain.com/customer2.tar.gz\\students.txt with no luck, I manually convert to a zip file https://mydomain.com/customer2.zip\\students.txt but nothing works.

Thanks

VictorV

Best answer by pallegama

Hi @velasquezvictor,

I agree with @stalknecht of using HTTPCaller in this case. Since you are looking for using same parameter for local and remote files, you can use a workflow as depicted in the attached workspace template.

zipfile-reader.fmwt

In this workflow, source file path (local or remote) should be passed through 'Source' Published Parameter and the first Tester identifies and divert remote paths to download the zip/gz file before passing it to FeatureReader. This workspace works on both FME Desktop and FME Server.

Alternatively, you can think of writing a Startup Python script to do this.

Regards, Priyantha Pallegama

View original
This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

5 replies

stalknecht
Contributor
Forum|alt.badge.img+22
  • Contributor
  • Jul 23, 2017 10:01 AM UTC

Hi Victor you should use a slash instead of a ". "

https://mydomain.com/customer2.tar/gzstudents.txt


Forum|alt.badge.img

HiĀ VictorĀ youĀ shouldĀ useĀ aĀ slashĀ insteadĀ ofĀ aĀ ".Ā "

https://mydomain.com/customer2.tar/gzstudents.txt

HiĀ IĀ useĀ https://mydomain.com/customer2.tar.gz/students.txtĀ forĀ gzipĀ andĀ https://mydomain.com/customer2.zip/students.txtĀ forĀ theĀ zipĀ fileĀ aĀ noneĀ ofĀ themĀ works.Ā IĀ receiveĀ theĀ error:Ā 

Ā 

Ā 

CSVĀ reader:Ā FailedĀ toĀ openĀ fileĀ 'https://mydomain.com/customer2.tar.gz/students.txt'Ā forĀ reading.Ā PleaseĀ ensureĀ thatĀ theĀ fileĀ existsĀ andĀ youĀ haveĀ sufficientĀ privilegesĀ toĀ readĀ it

Ā 

IĀ verifiedĀ andĀ theĀ zip/tar.gzĀ fileĀ hasĀ students.txtĀ inside.

Ā 

Ā 


stalknecht
Contributor
Forum|alt.badge.img+22
  • Contributor
  • Jul 27, 2017 1:01 AM UTC
HiĀ IĀ useĀ https://mydomain.com/customer2.tar.gz/students.txtĀ forĀ gzipĀ andĀ https://mydomain.com/customer2.zip/students.txtĀ forĀ theĀ zipĀ fileĀ aĀ noneĀ ofĀ themĀ works.Ā IĀ receiveĀ theĀ error:Ā 

Ā 

Ā 

CSVĀ reader:Ā FailedĀ toĀ openĀ fileĀ 'https://mydomain.com/customer2.tar.gz/students.txt'Ā forĀ reading.Ā PleaseĀ ensureĀ thatĀ theĀ fileĀ existsĀ andĀ youĀ haveĀ sufficientĀ privilegesĀ toĀ readĀ it

Ā 

IĀ verifiedĀ andĀ theĀ zip/tar.gzĀ fileĀ hasĀ students.txtĀ inside.

Ā 

Ā 

DoĀ youĀ runĀ itĀ fromĀ FMEĀ Server?

Ā 

Ā 

YouĀ canĀ useĀ theĀ HTTPCallerĀ toĀ downloadĀ theĀ fileĀ locallyĀ andĀ thenĀ useĀ aĀ FeatureReaderĀ toĀ readĀ it.

Ā 

Ā 


Forum|alt.badge.img
Do you run it from FME Server?

Ā 

Ā 

You can use the HTTPCaller to download the file locally and then use a FeatureReader to read it.

Ā 

Ā 

Ā 

Hi,

Ā 

Ā 

I Would Like to use the same parameter for the reader to load locally, temporary upload or a remote file.

pallegama
Contributor
Forum|alt.badge.img+8
  • Contributor
  • Best Answer
  • Jul 27, 2017 5:31 AM UTC

Hi @velasquezvictor,

I agree with @stalknecht of using HTTPCaller in this case. Since you are looking for using same parameter for local and remote files, you can use a workflow as depicted in the attached workspace template.

zipfile-reader.fmwt

In this workflow, source file path (local or remote) should be passed through 'Source' Published Parameter and the first Tester identifies and divert remote paths to download the zip/gz file before passing it to FeatureReader. This workspace works on both FME Desktop and FME Server.

Alternatively, you can think of writing a Startup Python script to do this.

Regards, Priyantha Pallegama