Skip to main content
Question

How can I upload zipped-up file geodatabase to FME Server and kick off a workspace using Python?

  • February 25, 2016
  • 4 replies
  • 81 views

I have workspaces published in FME Server and have created a web form where users can upload zipped-up file geodatabases which get processed and loaded into a master database. Now some users want to automate that process using Python so they don't have to use the web form but can have a Python script that can be set to run automatically once a month and upload the data. I have seen bits and pieces of code and functionality which are tantalizingly close to what I want to do but not quite. Has anyone out there ever done this?

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.

4 replies

redgeographics
Celebrity
Forum|alt.badge.img+62

You can create a notification that's triggered by a file upload, using the Directory Watcher publication. That bypasses the web form alltogether. There doesn't seem to be a recent tutorial on that though.

Alternatively... you could schedule the Python upload every month and then create a 2nd monthly schedule in FME Server that kicks off your workspace a little while after the upload, bypassing the notification system entirely.


fmelizard
Safer
Forum|alt.badge.img+21
  • Safer
  • February 25, 2016

Here is a script for running a job on FME Server using Python:

 

http://playground.fmeserver.com/other-languages/py...

This shows how to interact with FME Server in python. You can modify this script to upload files to the Resource area using REST calls. Screenshot:

https://www.dropbox.com/s/lbqupzhnqigwmk1/Screensh...

---

I also like the suggestion from @redgeographics about using the Directory Watch publication as well. There is a tutorial for that available at:

https://knowledge.safe.com/articles/1401/directory...

---

Alternatively, a scheduled job could be setup on FME Server to search specific directories and process the data as well. This assumes that FME Server can see the directories where users place the files.


  • Author
  • March 7, 2016

Here is a script for running a job on FME Server using Python:

 

http://playground.fmeserver.com/other-languages/py...

This shows how to interact with FME Server in python. You can modify this script to upload files to the Resource area using REST calls. Screenshot:

https://www.dropbox.com/s/lbqupzhnqigwmk1/Screensh...

---

I also like the suggestion from @redgeographics about using the Directory Watch publication as well. There is a tutorial for that available at:

https://knowledge.safe.com/articles/1401/directory...

---

Alternatively, a scheduled job could be setup on FME Server to search specific directories and process the data as well. This assumes that FME Server can see the directories where users place the files.

Thanks to all for the suggestions. I took @aaronkoning's advice and was able to create a Python script that uploads a zipped up FGDB to the shared resources directory and kicks off a workspace successfully. Unfortunately, it can't get to the FGDB inside the ZIP file. I get the following: Unable to connect to the File Geodatabase at 'C:'. I have tried setting the opt_extractarchive parameter to true but this had no effect. Is there a way to upload a ZIP file to the shared resources directory and have it unzip?


Forum|alt.badge.img

Here is a script for running a job on FME Server using Python:

 

http://playground.fmeserver.com/other-languages/py...

This shows how to interact with FME Server in python. You can modify this script to upload files to the Resource area using REST calls. Screenshot:

https://www.dropbox.com/s/lbqupzhnqigwmk1/Screensh...

---

I also like the suggestion from @redgeographics about using the Directory Watch publication as well. There is a tutorial for that available at:

https://knowledge.safe.com/articles/1401/directory...

---

Alternatively, a scheduled job could be setup on FME Server to search specific directories and process the data as well. This assumes that FME Server can see the directories where users place the files.

Is your reader a generic format reader or a filegeodatabase reader? I experienced some issues woth generic readers an zip files, but i'm not 100% sure if this is a gerneral problem, or if i just used it the wrong way.