Add mapping definition for MediaWiki table user_groups.
[philipp/winterrodeln/wrpylib.git] / wrpylib / wrorm.py
1 """
2 Usage:
3 >>> import sqlalchemy.orm
4 >>> import sqlalchemy.engine
5 >>> engine = sqlalchemy.engine.create_engine('mysql://philipp@localhost:3306/philipp_winterrodeln_wiki?charset=utf8mb4')
6 >>> Session = sqlalchemy.orm.sessionmaker(bind=engine)
7 >>> session = Session()
8 """
9 import sqlalchemy.orm
10 import wrpylib.mwdb
11 import wrpylib.wrmwdb
12
13
14 class Page:
15     pass
16
17
18 class WrIntermapsSledrun:
19     pass
20
21
22 class WrIntermapsReport:
23     pass
24
25
26 class WrIntermapsReportHistory:
27     pass
28
29
30 metadata = sqlalchemy.schema.MetaData()
31
32 page_table = wrpylib.mwdb.page_table(metadata)
33 wrintermapssledrun_table = wrpylib.wrmwdb.wrintermapssledrun_table(metadata)
34 wrintermapsreport_table = wrpylib.wrmwdb.wrintermapsreport_table(metadata)
35 wrintermapsreporthistory_table = wrpylib.wrmwdb.wrintermapsreporthistory_table(metadata)
36
37 sqlalchemy.orm.mapper(Page, page_table)
38 sqlalchemy.orm.mapper(WrIntermapsSledrun, wrintermapssledrun_table)
39 sqlalchemy.orm.mapper(WrIntermapsReport, wrintermapsreport_table)
40 sqlalchemy.orm.mapper(WrIntermapsReportHistory, wrintermapsreporthistory_table)