Hello there,

Is it possible to force database access to be read-only when executing
custom SQL?
I want to make a simple admin application that lets my clients execute
some SQL code (only "SELECT" queries, so they can pull out some data
when they need). I don't want them to mess up the database so I'd like
to force the read-only access for whatever they execute.

My model is:

class Query(models.Model):
    name = models.CharField(max_length=255)
    sql = models.TextField()
    description = models.TextField(blank=True)

    def execute(self):
        from django.db import connection
        cursor = connection.cursor()
        cursor.execute(self.sql)
        row = cursor.fetchall()
        return row

    class Admin:
        pass

What should I change to force the read-only access?

Thanks a lot!

Julien
--~--~---------~--~----~------------~-------~--~----~
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