24 lines
742 B
Python
24 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()
|