@jonathanchiang0, yes, this is possible - you need to make sure you import arcpy in your script. Also, make sure you set the python interpreter in the navigation panel, as shown below:
As an example - In the screenshot below, I used a PythonCaller to take each incoming shapefile, check to see if it already exists in the specified geodatabase, and if the FC does not already exist, it imports the shapefile into the GDB.
Make sure you drag/drop parameters and attributes from the panel on the left.
-Courtney
Another option is a shutdown script.
Another option is a shutdown script.
If you decide to use a Shutdown Script, you will manually have to type in parameters with the following format: $(PARAM_NAME)
Another thing to be aware of with shutdown scripts, is that you cannot incorporate attribute values into your script.
An example of when it is a good idea to use a shutdown script, is if you want to compress a versioned GDB after your workspace is done writing to it. You would use the following shutdown script (where there is a user parameter called GEODATABASE_SDE_CONNECTION_FILE that references the appropriate file):
import arcpyarcpy.Compress_management('$(GEODATABASE_SDE_CONNECTION_FILE)')
@jonathanchiang0, yes, this is possible - you need to make sure you import arcpy in your script. Also, make sure you set the python interpreter in the navigation panel, as shown below:
As an example - In the screenshot below, I used a PythonCaller to take each incoming shapefile, check to see if it already exists in the specified geodatabase, and if the FC does not already exist, it imports the shapefile into the GDB.
Make sure you drag/drop parameters and attributes from the panel on the left.
-Courtney
@
courtney_m Hi Courtney, Thanks a lot for providing such information. I am also wondering if it's possible to pass 2 or more feature types (data sets) to one python caller and let it process the data? In the python example I listed above, "feats" and "rts" represent 2 different feature classes and they were being gracefully processed through an arcpy function. Can FME handle such task?
Maybe I used the term "features" wrong, what I really meant is Feature Types or data sets. In the python example I listed above, "feats" and "rts" represent 2 different feature classes and they are gracefully being processed through an arcpy function. I am not sure if FME's Python Caller can handle multiple feature types at a time? Thanks.