I just tried it and it doesn't. If I try an aggregate query such as
using COUNT(account_number) without the Where clause, I get a row with
0 in it (there are thousands of account_numbers).

Thanks for the suggestion.



On Oct 19, 1:30 pm, dmitry b <dmitry.ma...@gmail.com> wrote:
> see if a pamaterized query works:
>
>  cursor.execute('SELECT account_number FROM vw_billed_summary_fact
> WHERE ippa=%s', ['col11-emnj00-1147'])
>
> d.
>
> On Oct 19, 8:25 am, msbuck <mbuckn...@usgs.gov> wrote:
>
>
>
>
>
>
>
> > I'm having another strange problem. I'm executing SQL statements
> > directly rather than using the ORM and it is working fine except when
> > I query one particular view. Then the query returns nothing. I can
> > execute the same query from python by using the cx_Oracle module
> > directly and it returns what I expect. Below is an example of what I'm
> > doing in the Django code (within a view):
>
> >     cursor = connection.cursor()
> >     cursor.execute('SELECT account_number FROM vw_billed_summary_fact
> > WHERE ippa=\'col11-emnj00-1147\'')
>
> > This should produce a single row and instead produces no rows. I've
> > tried using the COUNT aggregate to return the number of rows and this
> > also returns zero. I don't get errors ... just no data.
>
> > If I run a little python script that creates the connection directly
> > using cx_Oracle and execute the query I get the expected result.
>
> > Note that queries on other views and tables in the database work. Any
> > thoughts on what I'm doing wrong?
>
> > Thanks.

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