Maintaining data integrity in mysql when different applications are accessing it

Okay., We have Rails webapp which stores data in a mysql data base. The table design was not read efficient. So we resorted to creating a separate set of read only tables in mysql and made all our internal API calls use that tables for read. We used callbacks to keep the data in sync between both the set of tables. Now we have a another Python app which is going to mess with the same database - now how do we proceed maintaining the data integrity?

Active record callbacks can't be used anymore. We know we can do it with triggers. But is there a any other elegant way to do this? How to people achieve to maintain the integrity of such derived data.

Answers


Yes, refactor the code to put a data web service in front of the database and let the Ruby and Python apps talk to the service. Let it maintain all integrity and business rules.

"Don't Repeat Yourself" - it's a good rule.


Need Your Help

L4.2 Event: know where event got fired from?

laravel laravel-4

I have a question regarding Events with Laravel 4.2...

Close XLib application from another process

c linux signals x11 xlib

I have a Xlib-based program with an event loop that uses XNextEvent to receive and process relevant events.