#24200: Make introspection bypass statement caching on Oracle
-------------------------------------+-------------------------------------
     Reporter:  shaib                |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  Database layer       |                  Version:  1.8alpha1
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:  oracle               |             Triage Stage:
  introspection                      |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by jarshwah):

 I don't think we need to get too crazy with regards to cache busting.
 Simply setting the stmtcachesize to 0 and back to 20 clears the cache. We
 could also try to request a connection with caching disabled for
 migrations.

 {{{
 (Pdb) cursor = connection.cursor()
 (Pdb) cursor.execute('create table test_cache (int1 int, int2 int)')
 (Pdb) cursor.execute('select * from test_cache')
 <cx_Oracle.Cursor on <cx_Oracle.Connection to test_djangotests@django>>
 (Pdb) cursor.execute('select * from test_cache').fetchmany()
 []
 (Pdb) cursor.execute('alter table test_cache drop column int2')
 (Pdb) cursor.execute('select * from test_cache').fetchmany()
 *** django.db.utils.DatabaseError: ORA-01007: variable not in select list
 (Pdb) cursor.execute('select * from test_cache').fetchmany()
 *** django.db.utils.DatabaseError: ORA-01007: variable not in select list
 (Pdb) cursor.connection
 <cx_Oracle.Connection to test_djangotests@django>
 (Pdb) cursor.connection.stmtcachesize
 20
 (Pdb) cursor.connection.stmtcachesize = 0
 (Pdb) cursor.execute('select * from test_cache').fetchmany()
 []
 (Pdb) cursor.connection.stmtcachesize = 20
 (Pdb) cursor.execute('select * from test_cache').fetchmany()
 []
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24200#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.c7a99f2d93d754ec4c2b2fd03234e6f5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to