summaryrefslogtreecommitdiff
path: root/test.py
blob: 958c7b12e25e09ba21b21254cb6a5a75e5f0e4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from ebus.web import model

from sqlalchemy import create_engine

engine = create_engine('sqlite:///:memory:', echo=True)
#engine = create_engine("postgresql://yvesf:iii@10.2.2.13:5432/yvesf", echo=True)

model.ModelBase.metadata.create_all(engine)

from sqlalchemy.orm import sessionmaker
Session = sessionmaker()
Session.configure(bind=engine)

session = Session()


t1_sensor = model.Sensor("foosensor", "blatest")
session.add(t1_sensor)

for i in xrange(10):
    m = model.ValueInt(t1_sensor, 1)
    session.add( m )

    m = model.ValueFloat(t1_sensor, 1.2)
    session.add( m )

    m = model.ValueString(t1_sensor, "foobar")
    session.add( m )


session.commit()
session.close()