django-db-readonly icon indicating copy to clipboard operation
django-db-readonly copied to clipboard

ignore the write without generating the exception?

Open pcompassion opened this issue 9 years ago • 2 comments

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)

pcompassion avatar Sep 30 '14 08:09 pcompassion

Any news on this?

EralpB avatar Jan 15 '18 14:01 EralpB

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

jayvdb avatar Sep 16 '20 16:09 jayvdb