Login

Snippets by ryananguiano

Snippet List

Forcing DB on relationship manager with multiple database project

I have a master/slave SQL setup and sometimes I need to access the data immediately after write, but the data has not yet propagated to the slave yet. This forces me to require `.using('default')` every time that relationship is accessed. Ex: self.books.using('default').all().delete() Setting `objects = ForceDefaultDBManager()` on the related object removes this requirement throughout your code. This now does the same as the last example: self.books.all().delete()

Read More

ryananguiano has posted 1 snippet.