Skip to main content
Question

How do I write changes to a MYSQL database?


Forum|alt.badge.img+1

This is my first time using FME to update a database, I usually just write to another file.

 

I have connected to a specific table in the database (multimedia objects) and I've basically filtered and done a string replacer on some instances in a specific column (product_uri).

 

How do I now save these changes in the database? I just want to replace the 156 cells I string replaced and keep everything else as it was.

 

6 replies

nielsgerrits
VIP

Set Feature Operation to Update, radiobox Match Columns and select the unique ID here.

I would only send the changed features to the writer as the other features don't need to be updated.


Forum|alt.badge.img+1

Thank you! So these are my settings now:

fme3And I have a tester showing my string replacer worked,

fme5but the single row shows a sample of what was written - it has gone back to the original, it hasn't updated the product uri.

fme4Hopefully even with me covering part of the URL you can see it's still displaying the long version, not the shortened one that I want.


nielsgerrits
VIP
caitlin.thorn wrote:

Thank you! So these are my settings now:

fme3And I have a tester showing my string replacer worked,

fme5but the single row shows a sample of what was written - it has gone back to the original, it hasn't updated the product uri.

fme4Hopefully even with me covering part of the URL you can see it's still displaying the long version, not the shortened one that I want.

You only want to put the ID column in the Match Columns field. The writer uses this field to determine which record(s) need to be updated. The contents of the attributes in the features will update it. Your result now is probably nothing because the writer cant find a match between the features an the records based on the fields id and fileURI, because you changed the value of the field fileURI.


Forum|alt.badge.img+1
nielsgerrits wrote:

You only want to put the ID column in the Match Columns field. The writer uses this field to determine which record(s) need to be updated. The contents of the attributes in the features will update it. Your result now is probably nothing because the writer cant find a match between the features an the records based on the fields id and fileURI, because you changed the value of the field fileURI.

I only changed the field ProductURI not FileURI, but I removed it regardless and just used ID. I'm still having the same problem though, it's not updating.


steveatsafe
Safer
Forum|alt.badge.img+12

@caitlin.thorn did you get to the bottom of this?

Possibly it is an attribute name case ("id" is different from "ID") issue on the writer. Only included the attributes on the Writer that you want to update (and the unique id attribute(s)). Can you also confirm the attributes 'id' and 'fileURI' are both attributes in the table being updated and that they create a unique record?

 

Are you getting an error on this or is the workspace running and 'reporting' it is updating x number of records? Share any errors - ensure you scroll the log file for any blue text WARNS as well.

 

Do file a Case with us and address me if you need more assistance on this ( or reply here and I'll do my best)


Forum|alt.badge.img+1
steveatsafe wrote:

@caitlin.thorn did you get to the bottom of this?

Possibly it is an attribute name case ("id" is different from "ID") issue on the writer. Only included the attributes on the Writer that you want to update (and the unique id attribute(s)). Can you also confirm the attributes 'id' and 'fileURI' are both attributes in the table being updated and that they create a unique record?

 

Are you getting an error on this or is the workspace running and 'reporting' it is updating x number of records? Share any errors - ensure you scroll the log file for any blue text WARNS as well.

 

Do file a Case with us and address me if you need more assistance on this ( or reply here and I'll do my best)

Hi Steve, thank you for the response. Unfortunately I didn't get to the bottom of this and had to use a non-FME solution but I'll follow these steps in the future.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings