I am looking to adapt this code for a related array/type issue.  The code 
from https://gist.github.com/4433940 works just fine for me (as expected) 
when building/executing the stmt directly, but not when using the ORM.

When row is created using ORM, like this:

    # <snip>
    s = Session(bind=engine)
    e = Example()
    e.timestamp=datetime.datetime.utcnow(),
    e.num=2,
    e.guids = [uuid.uuid4(), uuid.uuid4()]
    s.add(e)
    s.commit()

I get an error like this:

<snip>
    return getter(visitor)(self, **kw)
  File 
"/home/hans/workspace/providence/env/lib/python2.7/site-packages/SQLAlchemy-0.8.0b2-py2.7-linux-x86_64.egg/sqlalchemy/sql/compiler.py",
 
line 760, in visit_bindparam
    bind_expression = bindparam.type.bind_expression(bindparam)
  File "test_array.py", line 38, in bind_expression
    for uuid_val in val
TypeError: 'object' object is not iterable

(I can dump in full stack if that would be helpful.) 

Indeed, inspecting that reveals that it is simply an object() instance. 
 I'm not sure where that is being set or whether there is an obvious 
workaround here.  I'm sure I'm simply missing obvious when it comes to 
dealing with native array types and ORM entity instances.

Thanks,
Hans 

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/ZwxFp2iasq0J.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to