On Fri, May 16, 2008 at 10:45 AM, enri57ar <[EMAIL PROTECTED]> wrote:
>
> I can't execute custom SQL. 'Cursor' object has no attribute
> 'fechone', and 'fechall'
> I have a model named 'Labels' with db_name = 'labels'.
>
You're missing a 't' in fetchone() and fetchall().
Karen
>
>
> mysql> SELECT id FROM labels;
> +----+
> | id |
> +----+
> | 1 |
> | 3 |
> +----+
> 2 rows in set (0.00 sec)
>
> ============================================
>
> >>> django.get_version()
> u'0.97-pre-SVN-7523'
> >>>
> >>> Labels.objects.count()
> 2L
> >>> from django.db import connection
> >>> cursor = connection.cursor()
> >>> cursor.execute("SELECT id FROM labels;")
> 2L
> >>>
> >>>
> >>> row = cursor.fechone()
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "C:\Python25\lib\site-packages\django\db\backends\util.py",
> line 42, in _
> _getattr__
> return getattr(self.cursor, attr)
> AttributeError: 'Cursor' object has no attribute 'fechone'
> >>>
> >>>
> >>> row = cursor.fechall()
> Traceback (most recent call last):
> File "<console>", line 1, in <module>
> File "C:\Python25\lib\site-packages\django\db\backends\util.py",
> line 42, in _
> _getattr__
> return getattr(self.cursor, attr)
> AttributeError: 'Cursor' object has no attribute 'fechall'
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---