On 6/06/2016 2:45 PM, Javier Candeira wrote:
Hi everyone,

For a job I've been asked to read some data from an external MSSQL database,
but I can't figure out how to configure a MSSQL driver on Django 1.8 site on
Ubuntu 14.04.

Maybe https://django-mssql.readthedocs.io/en/latest/

Then in 1.8 you need a settings.py which has a database config dict similar to this ...

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'NAME': PROJECT,
        'USER': dbhost[0],
        'PASSWORD': dbhost[1],
        'HOST': dbhost[2],
        'PORT': dbhost[3],
    }
}



Clarifications:
- We can access the MSSQL database using DBeaver, so not a credentials issue.
- We are reading from another external postgres database, so not a multi-DB
configuration issue.
- We have written the models, we don't need to inspect the MSSQL DB. All we
need is to read Foo.objects.all().

Usually for such a task you wouldn't write the models but instead after connecting to the MSSQL database run manage.py inspectdb to create a models module. That would pretty much guarantee the Foo table is correctly specified.

Try ~$python manage.py help inspectdb

Not sure if that helps

Mike


Thanks,

Javier
_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug


_______________________________________________
melbourne-pug mailing list
[email protected]
https://mail.python.org/mailman/listinfo/melbourne-pug

Reply via email to