1
0
Fork 0
gnuviechadmin-historic/testdb/gnuviechadmin/dblayer.py
Jan Dittberner dea15a6c4f - repository reorganization
git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/trunk@242 a67ec6bc-e5d5-0310-a910-815c51eb3124
2008-01-12 22:24:08 +00:00

23 lines
742 B
Python

from sqlalchemy import *
from entities import *
db = create_engine('postgres://jan:heyyou97@localhost:5432/testdb')
metadata = BoundMetaData(db)
domains_table = Table('domains', metadata, autoload = True)
sysuser_table = Table('sysuser', metadata, autoload = True)
mailpassword_table = Table('mailpassword', metadata, autoload = True)
client_table = Table('client', metadata, autoload = True)
popaccountmapper = mapper(PopAccount, mailpassword_table)
domainmapper = mapper(Domain, domains_table)
domainmapper.add_property('popaccounts', relation(PopAccount))
sysusermapper = mapper(SysUser, sysuser_table)
clientmapper = mapper(Client, client_table)
clientmapper.add_property('sysusers', relation(SysUser))
session = create_session()