I see running a separate thread using what defined in model is quite
easy:
(mydevenv)# pwd
/root/my-applications/sensor
(mydevenv)# python
Python 2.6.4 (r264:75706, Nov 11 2009, 18:50:22)
[GCC 4.2.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sensor
>>> from sensor.model import init_model
>>> from sqlalchemy import create_engine
>>> engine = create_engine('sqlite:///development.sqlite')
>>> init_model(engine)
>>> from sqlalchemy.orm import sessionmaker
>>> Session = sessionmaker(bind=engine)
>>> session = Session()
>>> from sensor.model import Acquisizioni
>>> from datetime import datetime
>>> acq = Acquisizioni(id_sens=1, dataora=datetime.now())
>>> session.add(acq)
>>> session.new
IdentitySet([<sensor.model.Acquisizioni object at 0x85a89ac>])
>>> session.commit
<bound method Session.commit of <sqlalchemy.orm.session.Session object
at 0x85a886c>>
>>> session.commit()
>>>
Is there an even easier way to make it run from Pylons so I don't have
to create engine but use Pylons' one?
Thanks for your support
neurino
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en.