Thursday, April 19, 2018

Re: Adding stored procedures

There are django-mssql and django_pyodbc but I was never able to get
either of those to work for me. I ended up using odbc - I couldn't use
the ORM, but I still was able to connect to the MSSQL DB from my
django app using raw queries.

On Wed, Apr 18, 2018 at 8:55 AM, Matthew Pava <Matthew.Pava@iss.com> wrote:
> Hi Chris,
>
> SQL Server is not one of the databases that Django supports out of the box.
> There are third party packages available, though, but I haven't tested any
> of them with recent versions.
>
> Saying that, you can create views in your database backend. In your
> migrations file, use the RunSQL operation.
>
> https://docs.djangoproject.com/en/2.0/ref/migration-operations/#runsql
>
>
>
> In your models file, change the Meta option, managed, to False.
>
> https://docs.djangoproject.com/en/2.0/ref/models/options/#managed
>
>
>
> Good luck!
>
>
>
> As for stored procedures and functions, I haven't worked enough with those
> mixed in with Django to give you much guidance except to do some more
> searching on the web. And I would also advise against using them so that
> you can keep your code in your Django project. I haven't found a need for
> them myself while using Django.
>
>
>
> From: django-users@googlegroups.com [mailto:django-users@googlegroups.com]
> On Behalf Of Chris Wedgwood
> Sent: Wednesday, April 18, 2018 1:50 AM
> To: django-users@googlegroups.com
> Subject: Adding stored procedures
>
>
>
> Hi All
>
>
>
> I am using SQL SERVER in my latest django project and I am going to be using
> some stored procedures.
>
>
>
> My question is about how to go about deploying stored procedure changes with
> django. I have looked through the migrations documentation which looks very
> specific to model changes.
>
>
>
> Has anyone had experience of having to create other things such a stored
> procedures/views/functions?
>
>
>
> thanks
>
> Chris
>
>
>
>
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACQBJYU5CDhCrP7cNRpzp7fRDr1pyf48css-EaVW%3Drj65SmEsg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscribe@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/58f5f935832647b0afd58ac5105b45f0%40ISS1.ISS.LOCAL.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACwCsY4OOb3HufKYQ8v2y5cUGgVWmhzBTMgO6hn%2BEO%3Dwi9swww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment