Az wrote:
> instance_dict(instance))
> AttributeError: 'NoneType' object has no attribute 'get'
> +++
>
>
> I'm at a loss as to how to resolve this issue, if it is an issue. If
> more information is required, please ask and I will provide it.
you'd have to illustrate a full test example which replicates this
behavior. I have re-built a test case from your fragments and cannot
reproduce:
from sqlalchemy import *
from sqlalchemy.orm import *
import collections
class Student(object):
def __init__(self, name, id):
self.id = id
self.name = name
self.preferences = collections.defaultdict(set)
self.own_proj_id = None
self.own_proj_sup = None
self.allocated_project = None
self.allocated_rank = 0
def __repr__(self):
return str(self)
def __str__(self):
return "%s %s" %(self.id, self.name)
engine = create_engine('sqlite:///:memory:', echo=False)
metadata = MetaData()
students_table = Table('studs', metadata,
Column('id', Integer, primary_key=True),
Column('name', String)
)
metadata.create_all(engine)
mapper(Student, students_table)
Session = sessionmaker(bind=engine)
sesh = Session()
students = {}
for id in xrange(10):
students[id] = Student("student %d" % id, id)
for student in students.itervalues():
print student
metadata.create_all(engine)
sesh.add_all(students.values())
sesh.flush()
for student in students.itervalues():
print student
sesh.commit()
for student in students.itervalues():
print student
zzzeek-3:sqlalchemy classic$ python test.py
0 student 0
1 student 1
2 student 2
3 student 3
4 student 4
5 student 5
6 student 6
7 student 7
8 student 8
9 student 9
0 student 0
1 student 1
2 student 2
3 student 3
4 student 4
5 student 5
6 student 6
7 student 7
8 student 8
9 student 9
0 student 0
1 student 1
2 student 2
3 student 3
4 student 4
5 student 5
6 student 6
7 student 7
8 student 8
9 student 9
>
> Kind regards,
>
> Az
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sqlalchemy?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en.