diff options
author | Random Hacker <random_hacker@xapek.org> | 2010-08-18 23:46:18 +0200 |
---|---|---|
committer | Random Hacker <random_hacker@xapek.org> | 2010-08-18 23:46:18 +0200 |
commit | de1bbfc28dd9dcc76f8d4a34e1524b1f3a594fdb (patch) | |
tree | 0281f29ff36bea9c4f981ca2756461fe32f0d2e4 /bin/ebus_dump.py | |
parent | 7ff580a6fe60f7e3ea160f7b181ff0fa934453ce (diff) | |
download | ebus-alt-de1bbfc28dd9dcc76f8d4a34e1524b1f3a594fdb.tar.gz ebus-alt-de1bbfc28dd9dcc76f8d4a34e1524b1f3a594fdb.zip |
running with pgsql
Diffstat (limited to 'bin/ebus_dump.py')
-rwxr-xr-x | bin/ebus_dump.py | 20 |
1 files changed, 16 insertions, 4 deletions
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 |