I am not trying to check the db name to the connection, I have multiple database setup in django and also used the database route
to create a failover
but I am wondering if I can get the name of the connection host or the name given to the settings...
for example
DATABASES = {
'default': { # trying to get this name 'default'
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db_name',
'USER': 'euser',
'PASSWORD': 'password',
'HOST': 'host', # trying to get this host name 'host'
'PORT': 3306,
},
'node2': { # trying to get this name 'node2'
'ENGINE': 'django.db.backends.mysql',
'NAME': 'db_name',
'USER': 'euser',
'PASSWORD': 'password',
'HOST': 'host2', # trying to get this host name 'host2'
'PORT': 3306,
},
}
Is it possible to get those names I commented out above?
For my failover, I am trying to send an email if another db is being used, but it would be great if I can get especially the host
so it would be easier on me
P.S. off topic, is it possible to change the name default
to other names? I tried changing it and I would get errors. Seems like I must have at least one database setting name called default
Thanks in advance for any help.