Re: [sqlalchemy] What is the best way to store runtime information in model?

2014-02-07 Thread Pavel Aborilov
Is it bad to use one session within app and never close it? On Friday, January 31, 2014 9:04:01 AM UTC+4, Pavel Aborilov wrote: I need to have access to this state in a whole life of app, but as I undestand it's not a good way to use one session all time. Proper way, to open session, do all

Re: [sqlalchemy] What is the best way to store runtime information in model?

2014-02-07 Thread Michael Bayer
you don’t need the session to be open to access object state. when you close the session, the objects that were in it become detached. if you are referring to them elsewhere, they still work fine. they just won’t know how to go out and access a database. if that’s all you need, you’re done.

[sqlalchemy] What is the best way to store runtime information in model?

2014-01-30 Thread Pavel Aborilov
Hi! What is the best way to store runtime information in model? And is it good idea to store one in a model(like online/offline, etc) for example: class User(Base):__tablename__ = 'users'id = Column(Integer, primary_key=True)username = Column(String, unique=True, nullable=False)

Re: [sqlalchemy] What is the best way to store runtime information in model?

2014-01-30 Thread Michael Bayer
On Jan 30, 2014, at 1:58 PM, Pavel Aborilov abori...@gmail.com wrote: Hi! What is the best way to store runtime information in model? attributes and columns have an .info property you can use, if this is per-attribute User.fullname.info[‘some_info’] = ‘bar’ otherwise certainly, store

Re: [sqlalchemy] What is the best way to store runtime information in model?

2014-01-30 Thread Pavel Aborilov
I need to have access to this state in a whole life of app, but as I undestand it's not a good way to use one session all time. Proper way, to open session, do all my stuff with DB, then close session. But then I lost my state. In java I have DAO layer and business object, that store all my db