nathan
2014-02-06 01:02:47 UTC
Hi,
I'm looping writing "Media" objects with SA, which are just rows in the db that represent media files. The same "Account" object/instance is used during each iteration of the loop and contains the user's username, among other things.
account = DBSession.query(Account).filter(Account.username=='username')
for fieldstorage in file_list:
filename = fieldstorage.filename
try:
media = Media()
DBSession.add(media)
media.create(account, filename)
transaction.commit()
except ...
What's happening is I'm getting the following exception on the 2nd iteration of the loop after I've committed one "Media" object:
Instance <Account at 0x1096bbb90> is not bound to a Session; attribute refresh operation cannot proceed
Please let me know if you need more info.
Thanks!
I'm looping writing "Media" objects with SA, which are just rows in the db that represent media files. The same "Account" object/instance is used during each iteration of the loop and contains the user's username, among other things.
account = DBSession.query(Account).filter(Account.username=='username')
for fieldstorage in file_list:
filename = fieldstorage.filename
try:
media = Media()
DBSession.add(media)
media.create(account, filename)
transaction.commit()
except ...
What's happening is I'm getting the following exception on the 2nd iteration of the loop after I've committed one "Media" object:
Instance <Account at 0x1096bbb90> is not bound to a Session; attribute refresh operation cannot proceed
Please let me know if you need more info.
Thanks!
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/groups/opt_out.