summaryrefslogtreecommitdiff
path: root/ebus-datastore/testfiles/bsdtest.py
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2013-04-20 22:26:55 +0200
committerYves Fischer <yvesf-git@xapek.org>2013-04-20 22:27:00 +0200
commit0fab00a2ff4fbe7c3c56b7bd2dc523eb974aba61 (patch)
tree3d8222d4e3de49172b410c3d1136dfaaa18294d0 /ebus-datastore/testfiles/bsdtest.py
parentb5c71cfd18eb145acb72d0a9b58c5b10fbeac74d (diff)
downloadebus-alt-0fab00a2ff4fbe7c3c56b7bd2dc523eb974aba61.tar.gz
ebus-alt-0fab00a2ff4fbe7c3c56b7bd2dc523eb974aba61.zip
sachen rumgeschoben, leveldb: 32bit fix
Diffstat (limited to 'ebus-datastore/testfiles/bsdtest.py')
-rw-r--r--ebus-datastore/testfiles/bsdtest.py49
1 files changed, 0 insertions, 49 deletions
diff --git a/ebus-datastore/testfiles/bsdtest.py b/ebus-datastore/testfiles/bsdtest.py
deleted file mode 100644
index b6587d0..0000000
--- a/ebus-datastore/testfiles/bsdtest.py
+++ /dev/null
@@ -1,49 +0,0 @@
-import bsddb
-import psycopg2
-from subprocess import Popen,PIPE
-import time
-import sys
-
-db = bsddb.btopen("test.btdbm")
-
-conn = psycopg2.connect("dbname=ebus user=ebus")
-cur = conn.cursor()
-sql = """SELECT * from sensor"""
-cur.execute(sql)
-sensors = cur.fetchall()
-sensors = map(lambda a: (a[0], a[1]), sensors)
-sensors = dict(sensors)
-cur.close()
-conn.close()
-
-pg_dump = Popen(["psql","-A","-t"], stdin=PIPE, stdout=PIPE)
-pg_dump.stdin.write("COPY value TO stdout WITH DELIMITER '|' NULL AS '';\n")
-pg_dump.stdin.close()
-
-c=0
-try:
- while not pg_dump.stdout.closed:
- line = pg_dump.stdout.readline()
- c += 1
- if line == "":
- continue
- (oid, s_timestamp, sensor_id, type, value_float, value_int, value_string) = line.split("|")
- name = sensors[int(sensor_id)]
- timestamp = time.strptime(s_timestamp.split(".")[0], "%Y-%m-%d %H:%M:%S")
- timestamp = time.mktime(timestamp)
- if type == "int":
- value= value_int
- elif type == "float":
- value = value_float
- else:
- continue
-
- db["%s:%d"%(name,timestamp)] = value
- if c%10000==0:
- print "%d: %s:%s=%s"%(c,name,s_timestamp,value)
-except KeyboardInterrupt:
- db.close()
-
-print "done"
-
-