From de1bbfc28dd9dcc76f8d4a34e1524b1f3a594fdb Mon Sep 17 00:00:00 2001 From: Random Hacker Date: Wed, 18 Aug 2010 23:46:18 +0200 Subject: running with pgsql --- bin/ebus_dump.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'bin') diff --git a/bin/ebus_dump.py b/bin/ebus_dump.py index a437b0d..7507738 100755 --- a/bin/ebus_dump.py +++ b/bin/ebus_dump.py @@ -6,9 +6,18 @@ from ebus.model.sql import ModelBase, EbusSQL, Value from ebus.model.sql import EbusSQL from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker +import logging -engine = create_engine('sqlite:///:memory:', echo=True) -#engine = create_engine("postgresql://yvesf:iii@10.2.2.13:5432/yvesf", echo=True) +logging.basicConfig() + +#logging.getLogger('sqlalchemy.engine').setLevel(logging.INFO) +logging.getLogger('sqlalchemy.engine').setLevel(logging.WARNING) + +logger = logging.getLogger('ebus.dump') +logger.setLevel(logging.INFO) + +#engine = create_engine('sqlite:///:memory:', echo=True) +engine = create_engine("postgresql://jack:iii@localhost:5432/ebus") ModelBase.metadata.create_all(engine) @@ -25,10 +34,13 @@ class MyEbusReader(EbusReader): def handle_ebus(self,ebus_packet): for field in self.sql.get_values(ebus_packet): session.add(field) + session.commit() + logger.info("committed packet %s" % ebus_packet.name()) MyEbusReader() try: asyncore.loop() except KeyboardInterrupt: - for data in session.query(Value).all(): - print data + pass +# for data in session.query(Value).all(): +# print data -- cgit v1.2.1