I have to migrate some data from one MySQL database to another one, both credentials are in the Django app settings file, accessible and everything is OK.
My setting file is like this:
DATABASES = {
'default': {
'NAME': 'app_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 's3krit'
},
'prod_old': {
'NAME': 'old_app_data',
'ENGINE': 'django.db.backends.mysql',
'USER': 'mysql_user',
'PASSWORD': 'priv4te'
}
}
What i am think so for: document = Document.objects.using('prod_old').get(id=i)
then create another object in the default database using just Document()
without specifying the DB (Django will use the default). If i call Document().save()
do the ID coming from the using('prod_old')
get copied to the "Default DB" ?
Can't find anything clear on this situation ! Thanks for the help !