Can't get "Inserting large data sets" tutorial to work

Bug #545104 reported by Dave Flitney
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oursql
Fix Released
Medium
Aaron Gallagher

Bug Description

Was having trouble using the IterWrapper classes so tried to test with the tutorial example (see attached file). It fails with the following traceback:

[OVALTINE-VM6 flitney]# python oursqltest.py
In main!
Traceback (most recent call last):
  File "oursql_test.py", line 46, in ?
    db.insert_blobs();
  File "oursql_test.py", line 30, in insert_blobs
    iw = oursql.IterWrapper([u'foo', u'bar'])
  File "statement.pyx", line 30, in oursql.IterWrapper.__cinit__ (oursqlx/oursql.c:6429)
AttributeError: 'list' object has no attribute 'next'

Thanks,
Dave

Related branches

Revision history for this message
Dave Flitney (flitney) wrote :
Revision history for this message
Unode (simpledark+launchpad) wrote :

IterWrapper expects an iterator object.

Replace:
iw = oursql.IterWrapper([u'foo', u'bar'])
by:
iw = oursql.IterWrapper(iter([u'foo', u'bar']))

Revision history for this message
Aaron Gallagher (habnabit) wrote :

This is partly an oursql bug and partly a documentation bug. The correct behavior is what's listed in the documentation already; IterWrapper should take an iterable, not an iterator. I just forgot that I hadn't tested every snippet in the docs or I would've caught this sooner.

A fix is forthcoming.

Changed in oursql:
importance: Undecided → Medium
status: New → In Progress
assignee: nobody → Aaron Gallagher (habnabit)
milestone: none → 0.9.2
Changed in oursql:
status: In Progress → Fix Committed
Changed in oursql:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.