streeter / django-db-readonly

Force an entire site to become readonly. In a sort of hackish way.
MIT License
107 stars 21 forks source link

ignore the write without generating the exception? #9

Open pcompassion opened 9 years ago

pcompassion commented 9 years ago

Can I use this app to ignore the write sql?

I'm replicating a db to a slave, which is readonly. (and want to see the data in the db)

EralpB commented 6 years ago

Any news on this?

jayvdb commented 3 years ago

You would need to enhance ReadOnlyCursorWrapper.execute/executemany to bail out without the exception. I have seen projects which patch the cursors to make them no-op.

https://github.com/raymondbutcher/django-readwrite might also be of interest - they are also fiddling at the cursor level.

Also worth looking at, are all the varied db routers

https://www.google.com/search?q=django+db+router+site:pypi.org https://github.com/ambitioninc/django-dynamic-db-router looks good, but I havent got its test suite running yet on modern Django.

Another monkey patch, this time at the connection level, but not a standalone component https://github.com/autotest/autotest/blob/0d527f4a904ba121fdc547da6849392fed3549ed/frontend/afe/readonly_connection.py