Am trying to use a non-orm database in django. To do that, defined it in settings.py like -
DATABASES[‘other_db’]={…}
And use it in a view function like
with connections['other_db'].cursor() as cursor:
query = “SELECT * FROM TABLE“
cursor.execute(query, [])
I can run the app fine and this code works. I have tests that use StaticLiveServerTestCase and the test fails with -
django.test.testcases.DatabaseOperationForbidden: Database threaded connections to ‘other_db’ are not allowed in this test. Add ‘other_db’ to xxx.yyy.databases to ensure proper test isolation and silence this failure.
I can’t add other_db to databases in the test since django attempts to write to the db during initialization. Could you please help with what the right solution is here -
django version - 5.2.7
oracledb version - 3.3.0