Question

truncate table and append

  • 18 January 2022
  • 8 replies
  • 237 views

Badge +8

I need to truncate the existing table and append data. I have two tables one from versioned sde and the second table is in FGDB. I need to delete rows from the table in sde and append data from FGDB. I have to do field mapping after appending data from FGDB. I am not sure what would be the workaround to accomplish this task. Please suggest any workaround.


8 replies

Userlevel 2
Badge +17

Hi @fme_can_do_it​ , have you tried setting Truncate Existing to the Table Handling parameter in the writer feature type? 

Badge +8

Hi @fme_can_do_it​ , have you tried setting Truncate Existing to the Table Handling parameter in the writer feature type? 

Hi @Takashi Iijima. I need to truncate the table before writing to my destination table. Also, after truncating rows, I need to append data in the table from file gdb and perform field mapping, then I will write the final data.

Userlevel 2
Badge +17

Hi @Takashi Iijima. I need to truncate the table before writing to my destination table. Also, after truncating rows, I need to append data in the table from file gdb and perform field mapping, then I will write the final data.

The writer feature type with "Truncate Existing" mode will firstly truncate (delete all records from) existing table and then insert all the new records into the table. Isn't it your desired behavior?

Badge +8

Hi @Takashi Iijima. I need to truncate the table before writing to my destination table. Also, after truncating rows, I need to append data in the table from file gdb and perform field mapping, then I will write the final data.

Yes, but it's slightly different. I want to map fields as well before writing this to my final destination table. Is there any way we can set up a call so I can explain better what I am actually needing to accomplish? that would be a great help if it's possible.

Userlevel 2
Badge +17

Hi @Takashi Iijima. I need to truncate the table before writing to my destination table. Also, after truncating rows, I need to append data in the table from file gdb and perform field mapping, then I will write the final data.

Do you need to configure new fields in the destination table automatically mirroring the source dataset schema?

Badge +8

Hi @Takashi Iijima. I need to truncate the table before writing to my destination table. Also, after truncating rows, I need to append data in the table from file gdb and perform field mapping, then I will write the final data.

So the schema is not the same, so if I truncate and append data,I am going to have some fields blank due to different field names and I will have to populate those fields that remained blank after append data.

Userlevel 2
Badge +17

Set "Drop and Create" to the Table Handling parameter rather than "Truncate Existing", if you need to change the destination table schema.

And if you need to configure the destination schema dynamically, see this article to learn dynamic workflow.

 

Badge +2

@fme_can_do_it​ I think you can use the AttributeManager to do the field mapping between the File GDB and the ArcSDE GDB. Then you can use the Truncate Existing in the Table Handling parameter in the Writer Feature Type, as suggested by @Takashi Iijima​ . If you have many feature classes and attributes you can try the SchemaMapper for the field mapping.

Most of these steps are covered in our free, online FME Academy training modules if you are new to FME.

Reply