List Info

Thread: Any SELECT returns no results via Django




Any SELECT returns no results via Django
user name
2007-12-19 18:41:30
I am boggled. A SELECT from the MySql command line works
just fine.
But within Django, it returns nothing. It doesn't matter
what SQL
statement I issue.

Here is my syntax:


 from django.db import connection
  cursor = connection.cursor()
  cursor.execute("use editorial_production_2007_12_14;
SELECT
category_id,message_id FROM categories_messages")

 rows = cursor.fetchall()

I'm stuck using Django 0.95 and Python 2.4 on an X86-64
Linux box.

Has anyone else experienced this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Any SELECT returns no results via Django
user name
2007-12-20 09:43:17
More info on this: I am connecting to the db via an ssh
tunnel. In the
settings-*.py files, I use
DATABASE_HOST = '127.0.0.1'
Works like a charm, except with the connection module. It is
probably
not connecting.
Help!
Gloria

On Dec 19, 7:41 pm, Gloria W <strang...comcast.net> wrote:
> I am boggled. A SELECT from the MySql command line
works just fine.
> But within Django, it returns nothing. It doesn't
matter what SQL
> statement I issue.
>
> Here is my syntax:
>
>  from django.db import connection
>   cursor = connection.cursor()
>   cursor.execute("use
editorial_production_2007_12_14; SELECT
> category_id,message_id FROM categories_messages")
>
>  rows = cursor.fetchall()
>
> I'm stuck using Django 0.95 and Python 2.4 on an X86-64
Linux box.
>
> Has anyone else experienced this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Any SELECT returns no results via Django
user name
2007-12-20 10:41:10


On Dec 20, 1:41 am, Gloria W <strang...comcast.net> wrote:
> I am boggled. A SELECT from the MySql command line
works just fine.
> But within Django, it returns nothing. It doesn't
matter what SQL
> statement I issue.
>
> Here is my syntax:
>
>  from django.db import connection
>   cursor = connection.cursor()
>   cursor.execute("use
editorial_production_2007_12_14; SELECT
> category_id,message_id FROM categories_messages")
>
>  rows = cursor.fetchall()

Try executing those queries one at a time. I don't know
about the
other database backends, but the MySQL driver can only
execute 1 query
at a time.

>
> I'm stuck using Django 0.95 and Python 2.4 on an X86-64
Linux box.
>
> Has anyone else experienced this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: Any SELECT returns no results via Django
user name
2007-12-20 10:43:53


On Dec 20, 1:41 am, Gloria W <strang...comcast.net> wrote:
> I am boggled. A SELECT from the MySql command line
works just fine.
> But within Django, it returns nothing. It doesn't
matter what SQL
> statement I issue.
>
> Here is my syntax:
>
>  from django.db import connection
>   cursor = connection.cursor()
>   cursor.execute("use
editorial_production_2007_12_14; SELECT
> category_id,message_id FROM categories_messages")
>
>  rows = cursor.fetchall()

Btw, if 'editorial_production_2007_12_14' is the name of the
database
you specified in settings.py there's no reason to manually
select it.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )