Hi All,
Give the following model:
"""
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.types import Integer
Base = declarative_base()
class Model(Base):
__tablename__='test'
id = Column(Integer, primary_key=True)
col = Column(Integer)
"""
...the following code will give obj an id:
obj = Model()
session.add(obj)
session.flush()
What ensures obj.id will be unique and will it always be unique, even in
the case of high volumes of parallel writes to the database? Does it
depend on the back end? Are any backends known not to work this way?
Also, if I have a session extension which uses the value of obj.id to
populate obj.col in the after_flush method of the session, is that a
legit thing to do, and will id always be available to use, and unique as
above?
cheers,
Chris
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalch...@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.