I understand how to handle several databases through routers, however, how would it be handled when I have two databases with the same structure but it is required to save the information according to the database chosen by the user when starting a session . I have a session login with its corresponding username and password, in addition to that it is mandatory that the user choose a database through a selector to start the session to the application correctly, this information on the name of the selected database is moves through a session cookie for the entire session (forgive the redundancy), all the operations of the application must be done on the database that was initially selected in the access login, how to correctly route the databases for this case?
DATABASES = {
'default' : {
'ENGINE': 'django.db.backends.mysql',
'NAME': env.str('NAME_DB_ZF'),
'USER': env.str('USER_DB'),
'PASSWORD': env.str('PASS_DB'),
'HOST': 'localhost',
'PORT': '3306',
},
'SBOJOZF': {
'ENGINE': 'django.db.backends.mysql',
'NAME': env.str('NAME_DB_ZF'),
'USER': env.str('USER_DB'),
'PASSWORD': env.str('PASS_DB'),
'HOST': 'localhost',
'PORT': '3306',
},
'SBOJOCOL': {
'ENGINE': 'django.db.backends.mysql',
'NAME': env.str('NAME_DB_COL'),
'USER': env.str('USER_DB'),
'PASSWORD': env.str('PASS_DB'),
'HOST': 'localhost',
'PORT': '3306',
}
}