summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorRandom Hacker <random_hacker@xapek.org>2011-07-21 21:52:10 +0200
committerRandom Hacker <random_hacker@xapek.org>2011-07-21 21:56:48 +0200
commit02cab0b768b01a6c7b4c8b57362e992d1078c644 (patch)
tree9371dd20bf9e4c3630ef21b8ad6ad94c511e766f /bin
parent43145b8d951078d202367e9eee3f2a0bac67e4ae (diff)
downloadebus-alt-02cab0b768b01a6c7b4c8b57362e992d1078c644.tar.gz
ebus-alt-02cab0b768b01a6c7b4c8b57362e992d1078c644.zip
webapp: 500 werte, native sqL
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ebus_dump.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/ebus_dump.py b/bin/ebus_dump.py
index 7507738..2d6933c 100755
--- a/bin/ebus_dump.py
+++ b/bin/ebus_dump.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python
# -*- coding:utf8 -*-
import asyncore
+import time
from ebus import EbusReader
from ebus.model.sql import ModelBase, EbusSQL, Value
from ebus.model.sql import EbusSQL
@@ -17,7 +18,7 @@ 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")
+engine = create_engine("postgresql:///ebus")
ModelBase.metadata.create_all(engine)
@@ -34,8 +35,12 @@ 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())
+
+ if int(time.time()) % 4 == 0:
+ logger.info("COMMIT")
+ session.commit()
+
+ logger.info("packet %s" % ebus_packet.name())
MyEbusReader()
try: