I'm not sure how to check this. There are many other tables and views
in the database which I have no trouble retrieving data from. I can
use SQL Developer to execute the query on the view using the same
username, password, and database name. When I used cx_Oracle directly,
I am creating the connection name using the values in the settings
module and the query works then. I should also note that I am only
specifying the 'default' in DATABASES.

I'm shooting in the dark now ... could it have anything to do with how
the view is set up? If so what  (I'm a SQL newbie)?


On Oct 19, 2:45 pm, dmitry b <dmitry.ma...@gmail.com> wrote:
> I'm starting to doubt this is a Django issue.  Double check that you
> are connecting to the database/schema you *think* you are connecting
> to and you are using the use account you *think* you are using :)
>
> D.
>
> On Oct 19, 11:46 am, msbuck <mbuckn...@usgs.gov> wrote:
>
>
>
>
>
>
>
> > 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