These are chat archives for django/django

28th
Apr 2017
:]
@elcolie
Apr 28 2017 03:31
Hi. How do I sync table between DB1 and DB2?
Any good library or best practice?
Anish Shrestha
@annshress
Apr 28 2017 06:27

Inside a TestCase,
I have loaded fixtures into test db.

Now say I create an instance under a test_a method. It doesn't seem to reflect in another test_b method. Is this how django TestCase works? Can I make such changes persist across test_ methods under the same TestCase???

Anish Shrestha
@annshress
Apr 28 2017 06:52
ok so it does not. For such kinds of global stuff, we need to simply implement them in the setUp method.
MBijman
@MBijman
Apr 28 2017 09:28
@elcolie If you explain the problem, I can give you a solution.
:]
@elcolie
Apr 28 2017 09:31
The problem is I have single Django system. Then I split it into 2 Django system. Unfortunately, the models has reverse relation by ForeignKey and M2M a lot.
I have 2 solutions in my mind:
  1. Sync models between first database and second database
  2. Create new model with relational table in second database with endpoint. Currently I am working on No.2
MBijman
@MBijman
Apr 28 2017 10:37
@elcolie If I understand it correctly you have two instances of django running?
and you want to connect to the same database?
:]
@elcolie
Apr 28 2017 10:45
No no. It is not a replicated database. Two database but one of them would like to has identical synchronized tables. No worry I just finish the implementation by Django REST
MBijman
@MBijman
Apr 28 2017 10:53
setup 2 databases, one for each django instance and one with the shared table.
syncing data is very difficult problem, you will have raceconditions everywhere
:]
@elcolie
Apr 28 2017 12:01
@MBijman Thank you for your information. I just know from you that it is hard problem. Otherwise I may under estimate and hit the wall, waste my time, pull my hair