No, I don't think you're mistaken, especially if you want to use hints.

I tried this code again today with the django database connection (using 1.2 final), and it didn't work. This only works with cx_Oracle connections.

See http://drumcoder.co.uk/blog/2010/apr/23/output-parameters-cx_oracle-and-plsql/

Ian said in the other thread: "Otherwise, you can get the
cx_Oracle cursor from cursor.cursor and use that directly." This sounds like a way of being able to use the django connection but use the direct cx_Oracle functionality.

Random thought - have you tried sqlalchemy? Does that have hint support? I've never used it.

Tim.

On 18/08/10 21:58, buddhasystem wrote:

Thanks, I'll look into that. In the meantime, I managed to just use the
cursor from cx_Oracle (as in the example on Oracle site) and the code looks
slightly more elegant.

However, both "my" and yours solution suffer from the same defect imho --
that the ORM machinery of Django is unusable. We are back to manual mapping
of rows onto objects... Or -- am I mistaken?



Tim Sawyer-6 wrote:

Friends,

I'm in need of an implementation which calls for using bind variables (in
Oracle sense, not generic) in my SQL in a Django application.

Any experience with that, anyone?

Here's an example using bind variables to return output values from a
PL/SQL block.

   >>>  import cx_Oracle
   >>>  from django.db import connection
   >>>  cursor = connection.cursor()
   >>>  lOutput = cursor.var(cx_Oracle.STRING)
   >>>  cursor.execute("BEGIN %s := 'N'; END; ", [lOutput])
   >>>  print lOutput
   <cx_Oracle.STRING with value None>
   >>>  print lOutput.getvalue()
   None
   >>>

There was a bug in Django that prevented this working (hence the None in
the code above) - it's fixed in Django 1.2. The full thread for this is
at
http://www.mail-archive.com/django-users@googlegroups.com/msg100490.html

Hope that will help send you in the right direction.

Tim.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@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.





--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to django-us...@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