Skip to main content
Solved

Python libraries run before workbench

  • September 21, 2017
  • 3 replies
  • 18 views

oliver.morris
Contributor
Forum|alt.badge.img+14

I am new to using FME cloud, can you please explain how I can install custom python libraries onto FME Cloud and call them before the workbench runs. I would like to drop and create an elasticsearch index before the workbench then goes and populates it.

Many Thanks,

Oliver

The current python code is:

import pyodbc, json
from elasticsearch import Elasticsearch
es = Elasticsearch([{'host': 'search-dev-elasticsearch-z4b7vwlsqswv4uial343rdjccq.us-east-1.es.amazonaws.com', 'port': 443}],use_ssl=True,verify_certs=False)

es.indices.delete(index='productdownloadsdb_full', ignore=[400, 404])

mapping = '''
{    "mappings": {
      "downloads": {
        "properties": {
          "HYPERLINK_PDF": {
            "type": "text"
          },
          "HYPERLINK_ZIP": {
            "type": "text"
          },
          "ID": {
            "type": "integer"
          },
          "PDF_BODY": {
            "type": "text"
          },
          "PDF_FILE": {
            "type": "text"
          },
          "Title": {
            "type": "text"
          },
          "ZIP_FILE": {
            "type": "text"
          },
          "geometry": {
            "type": "geo_point"
          }
        }
      }
    }
  }
'''
es.indices.create(index='productdownloadsdb_full', ignore=400, body=mapping) 

Best answer by david_r

Have a look here:

https://knowledge.safe.com/questions/4164/python-libraries-on-fme-cloud.html

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.

3 replies

redgeographics
Celebrity
Forum|alt.badge.img+62

You can import custom python modules into FME Cloud using these steps


david_r
Celebrity
  • Best Answer
  • September 21, 2017

oliver.morris
Contributor
Forum|alt.badge.img+14
  • Author
  • Contributor
  • September 21, 2017

excellent, thank you so much