Start to add ORM classes for MediaWiki and Winterrodeln tables.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Tue, 17 Dec 2019 20:19:07 +0000 (20:19 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Tue, 17 Dec 2019 20:19:07 +0000 (20:19 +0000)
git-svn-id: http://www.winterrodeln.org/svn/wrpylib/trunk@2854 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrpylib/wrorm.py [new file with mode: 0644]

diff --git a/wrpylib/wrorm.py b/wrpylib/wrorm.py
new file mode 100644 (file)
index 0000000..dff6d7c
--- /dev/null
@@ -0,0 +1,27 @@
+"""
+Usage:
+>>> import sqlalchemy.orm
+>>> import sqlalchemy.engine
+>>> engine = sqlalchemy.engine.create_engine('mysql://philipp@localhost:3306/philipp_winterrodeln_wiki?charset=utf8&use_unicode=1')
+>>> Session = sqlalchemy.orm.sessionmaker(bind=engine)
+>>> session = Session()
+"""
+import sqlalchemy.orm
+import wrpylib.mwdb
+import wrpylib.wrmwdb
+
+
+class Page:
+    pass
+
+
+class WrIntermapsSledrun:
+    pass
+
+
+metadata = sqlalchemy.schema.MetaData()
+wrintermapssledrun_table = wrpylib.wrmwdb.wrintermapssledrun_table(metadata)
+page_table = wrpylib.mwdb.page_table(metadata)
+
+sqlalchemy.orm.mapper(WrIntermapsSledrun, wrintermapssledrun_table)
+sqlalchemy.orm.mapper(Page, page_table)