Django project - how to combine two different types of databases (sqlite3 to mssql)
I took over an unfinished project from someone else and built a new user system based on Django authentication syste. It is when everything is done I found out that the system was connected to the default sqlite3 db while everything else was connected to mssql...
setting.py
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
},
'nlp_db': {
'ENGINE': 'mssql',
'HOST': 'DESKTOP',
'PORT': '1433',
'NAME': 'my_db',
'USER': 'guest',
'PASSWORD': 'password',
'OPTIONS': {
'driver': 'ODBC Driver 18 for SQL Server',
},
},
}
Anybody know how to combine the sqlite3 into the mssql? I have tried Django : Transfer data from Sqlite to another database and chenged the setting.py to the codes below but gets error(seems not compatible)
DATABASES = {
'default': {
'ENGINE': 'mssql',
'HOST': 'DESKTOP',
'PORT': '1433',
'NAME': 'my_db',
'USER': 'guest',
'PASSWORD': 'password',
},
}
Error Msg
pyodbc.IntegrityError: ('23000', "[23000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server] Cannot insert the value NULL into column 'name', table
'my_db.dbo.django_content_type'; column does not allow nulls. INSERT fails. (515)
my_db.dbo.django_content_type
is a table already exist in mssql db but empty. I don't know how to fix this or should I delete my_db.dbo.django_content_type
? Anyone has any idea? Thanks in advance!