On Thu, 2007-06-21 at 13:05 -0500, Tim Chase wrote:
> > I want to use some stored procedures. I am mySql. Is there
> > some way I can define stored procedures from withing django? 
> > (We can call already defined procedures,
> > http://www.djangosnippets.org/snippets/118/ discusses how, but
> > can we also define stored procedures from within django?)
> 
> I don't believe Django holds your hand for creating SPs.  Each DB 
> engine tends to use its own languages for SPs which makes the 
> process even harder.  IIRC, PostgreSQL has support for SPs 
> written in Python in addition to umpteen other languages.  I 
> haven't toyed with SPs in MySQL, and I don't know if sqlite even 
> supports SPs (other than perhaps executing a bit of code on a 
> trigger).
> 
> You can always use cursor.execute() to create them, or you can 
> use Django's facilities for executing SQL when you 
> sqlcustom/sqlreset/sqlall/reset via manage.py as described at
> 
> http://www.djangoproject.com/documentation/model-api/#database-backend-specific-sql-data
> 
> and above.  However, I don't think there's much more in the way 
> of coddling facilities in Django.

Be aware, though, that there are lots of SQL constructs (including a lot
that crop up in stored procedures) that are not handled correctly in the
initial SQL parsing. For backend-specific stuff, that's a small bug. For
the more general initial SQL, it's an unsolvable problem.

So if you are using complicated SQL in your stored procedures, you may
need to load it manually.

Regards,
Malcolm


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to