Question

Table creation parameter per feature like fme_db_operation

  • 9 August 2021
  • 7 replies
  • 7 views

Badge +10

Hi, is it possible to control the table creation parameter from features when using a database writer? Like one can control the feature creation, removal or updating using an attribute fme_db_operation on the feature. I'm looking for some parameter fme_db_table_handling or so, but it does not seem to be documented?


7 replies

Userlevel 6
Badge +31

You can create a Parameter to do this. You can just generate that one yourself if needed by clicking the arrow next to it, User Parameter, Create User Parameter.

 

I don't know of an attribute which does this, like fme_db_operation.

Badge +10

Hi @nielsgerrits​ Thanks, I thought I remembered from an old database training that there was such an attribute. If I come across it, I will mention it here.

Userlevel 3
Badge +33

Hi @Helmoet de Zwijger​, there are some mentions of an attribute 'fme_table_handling' in the knowledge base: here and here.

In Feature Type 'xxxxxx', 'fme_table_handling' has invalid value 'CREATE_IF_MISSING'. Possible values include: 'CREATE_IF_MISSING', 'DROP_CREATE', 'USE_EXISTING'

This may well be the attribute you are looking for. Not sure whether it still works though...

Userlevel 6
Badge +31

Hi @Helmoet de Zwijger​, there are some mentions of an attribute 'fme_table_handling' in the knowledge base: here and here.

In Feature Type 'xxxxxx', 'fme_table_handling' has invalid value 'CREATE_IF_MISSING'. Possible values include: 'CREATE_IF_MISSING', 'DROP_CREATE', 'USE_EXISTING'

This may well be the attribute you are looking for. Not sure whether it still works though...

Good find!

Badge +10

O wow @geomancer​ , you found it... It is even still documented like here. However, it seems it does not work anymore by assigning it a value from, say, an AttributeCreator. I presume that is meant to be? It even appears in the .fmw scripts (line 12):

#!     <FEAT_ATTRIBUTE ATTR_NAME="downloadurl" ATTR_TYPE="char(255)" ATTR_HAS_PORT="true" ATTR_VALUE=""/>
#!     <FEAT_ATTRIBUTE ATTR_NAME="localfile" ATTR_TYPE="char(255)" ATTR_HAS_PORT="true" ATTR_VALUE=""/>
#!     <DEFLINE_PARM PARM_NAME="fme_advanced_group" PARM_VALUE="FME_DISCLOSURE_OPEN"/>
#!     <DEFLINE_PARM PARM_NAME="fme_configuration_common_group" PARM_VALUE=""/>
#!     <DEFLINE_PARM PARM_NAME="fme_configuration_group" PARM_VALUE=""/>
#!     <DEFLINE_PARM PARM_NAME="fme_feature_operation" PARM_VALUE="INSERT"/>
#!     <DEFLINE_PARM PARM_NAME="fme_match_columns" PARM_VALUE="<Unused>"/>
#!     <DEFLINE_PARM PARM_NAME="fme_selection_group" PARM_VALUE=""/>
#!     <DEFLINE_PARM PARM_NAME="fme_selection_method" PARM_VALUE="<Unused>"/>
#!     <DEFLINE_PARM PARM_NAME="fme_spatial_group" PARM_VALUE=""/>
#!     <DEFLINE_PARM PARM_NAME="fme_table_creation_group" PARM_VALUE="FME_DISCLOSURE_CLOSED"/>
#!     <DEFLINE_PARM PARM_NAME="fme_table_handling" PARM_VALUE="CREATE_IF_MISSING"/>
#!     <DEFLINE_PARM PARM_NAME="fme_update_geometry" PARM_VALUE="<Unused>"/>
#!     <DEFLINE_PARM PARM_NAME="fme_where_builder_clause" PARM_VALUE="<Unused>"/>
#!     <DEFLINE_PARM PARM_NAME="postgis_allow_serial_writing" PARM_VALUE="NO"/>
#!     <DEFLINE_PARM PARM_NAME="postgis_create_gist_index" PARM_VALUE="YES"/>
#!     <DEFLINE_PARM PARM_NAME="postgis_spatial_column" PARM_VALUE="geom"/>
#!     <DEFLINE_PARM PARM_NAME="postgis_spatial_column_type" PARM_VALUE="geometry"/>
#!     <DEFLINE_PARM PARM_NAME="postgis_srid" PARM_VALUE="28992"/>
#!     <DEFLINE_PARM PARM_NAME="postgis_vacuum_analyze" PARM_VALUE="NO"/>
#! </FEATURE_TYPE>
#! </FEATURE_TYPES>

Or am I expecting irrelevant things @Ryan Cragg​ ?

Userlevel 3
Badge +33

Hi @Helmoet de Zwijger​ , it's always nice to help an old friend.

As you say, the parameter 'fme_table_handling' still exists, and is still in use in the fmw files. 

Another example (line 8):

ORACLE_NONSPATIAL_1_DEF <table name> 
oracle_create_table "" 
oracle_drop_table "" 
oracle_table_writer_mode "" 
oracle_update_key_columns "" 
oracle_truncate_table "" 
fme_feature_operation INSERT
fme_table_handling DROP_CREATE   
<field definitions>

I hope someone from Safe can answer your questions!

Userlevel 2
Badge +9

Hi @Helmoet de Zwijger​,  this is an interesting one! I discussed the issue with my team and it sounds like the fme_table_handling parameter must be set before the workspace is run.

Some possible ways to get around this could be to try using a parameter fetcher or a workspace runner and set the parameter value before the workspace is run. Let me know how it goes, always here to help!

Reply