forked from Dakarlug/elasticsearch_river
-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.py
35 lines (21 loc) · 870 Bytes
/
models.py
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
from sqlalchemy import Column, Integer, String , Date , Boolean
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
import sys , os, datetime
sys.path.insert(0,os.path.join(os.path.dirname(__file__), ".."))
class ToDo(Base):
__tablename__ = 'ToDos'
id = Column(Integer, primary_key=True)
do = Column(String)
time = Column(Date)
done = Column(Boolean)
def __repr__(self):
return "<User(do='%s', time='%s', done='%s')>" % (
self.do, self.time, self.done)
#engine = create_engine('sqlite:///:memory:', echo=True)
engine = create_engine('postgresql://postgres:test@localhost:5432/mypgdb')
Base.metadata.create_all(engine)
Session = sessionmaker(bind=engine)
Session = Session()