title: Unit tests with an unmanaged external read-only database
body: <p>I'm working on a project which involves a huge external dataset (~490Gb) loaded in an external database (MS SQL through django-pyodbc-azure). I've generated the Django models marked <code>managed=False</code> in their meta. In my application this works fine, but I can't seem to figure out how to run my unit tests. I can think of two approaches: mocking the data in a test database, and giving the unit tests (and CI) read-only access to the production dataset. Both options are acceptable, but I can't figure out either of them:</p>
  
  <p><strong>Option 1: Mocked data</strong>
  Because my models are marked <code>managed=False</code>, there are no migrations, and as a result, the test runner fails to create the database.</p>
  
  <p><strong>Option 2: Live data</strong> 
  <code>django-pyodbc-azure</code> will attempt to create a test database, which fails because it has a read-only connection. Also I suspect that even if it were allowed to do so, the resulting database would be missing the required tables.</p>
  
  <p><strong>Q</strong> How can I run my unittests? Installing additional packages, or reconfiguring the database is acceptable. My setup uses django 1.9 with postgresql for the main DB.</p>