Our web site uses Django 1.2.  We're adding a layer to our MySQL
database called dbShards for fragmentation (sharding).  I need to
prepend instructive SQL comments (/* ... */) to UPDATE statements in
certain situations.  What's the best way to intercept the raw SQL sent
to the database?

I've come up with a couple ideas, but feel they are too invasive and
that there must be a better way.

Here's an example:  If the following code ...

        em = ExampleModel.objects.get( id = 1 )
        em.fieldname = "example"
        em.save()

Generated the following SQL:

        UPDATE examplemodel SET fieldname = 'example' WHERE id = 1;

Then I'd want my intercept code to prepend a comment like this to the
update statement.

        /* example comment */ UPDATE examplemodel SET fieldname = 'example'
WHERE id = 1;

Thanks,
Eric

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to