--- /dev/null
+#!/usr/bin/python2.6
+# -*- coding: iso-8859-15 -*-
+# $Id$
+# $HeadURL$
+"""This module contains code to make tha access of MediaWiki tables
+easy. The module uses sqlalchemy to access the database.
+"""
+from sqlalchemy import Table, Column, types
+
+
+def page_table(metadata):
+ """Returns the sqlalchemy Table representing the "page" table in MediaWiki.
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("page", metadata,
+ Column("page_id", types.Integer, primary_key=True),
+ Column("page_namespace", types.Integer, nullable=False),
+ Column("page_title", types.Unicode(255), nullable=False),
+ Column("page_restrictions", types.Unicode, nullable=False),
+ Column("page_counter", types.Integer, nullable=False),
+ Column("page_is_redirect", types.Integer, nullable=False),
+ Column("page_is_new", types.Integer, nullable=False),
+ Column("page_random", types.Float, nullable=False),
+ Column("page_touched", types.Unicode(14), nullable=False),
+ Column("page_latest", types.Integer, nullable=False),
+ Column("page_len", types.Integer, nullable=False),
+ )
+
+
+def revision_table(metadata):
+ """Returns the sqlalchemy Table representing the "revision" table in MediaWiki.
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("revision", metadata,
+ Column("rev_id", types.Integer, nullable=False, primary_key=True),
+ Column("rev_page", types.Integer, nullable=False, primary_key=True),
+ Column("rev_text_id", types.Integer, nullable=False),
+ Column("rev_comment", types.Unicode),
+ Column("rev_user", types.Integer, nullable=False),
+ Column("rev_user_text", types.Unicode(255), nullable=False),
+ Column("rev_timestamp", types.Unicode(14), nullable=False),
+ Column("rev_minor_edit", types.Integer, nullable=False),
+ Column("rev_deleted", types.Integer, nullable=False),
+ Column("rev_len", types.Integer, nullable=False),
+ Column("rev_parent_id", types.Integer, nullable=False),
+ )
+
+
+def text_table(metadata):
+ """Returns the sqlalchemy Table representing the "text" table in MediaWiki.
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("text", metadata,
+ Column("old_id", types.Integer, primary_key=True),
+ Column("old_text", types.Unicode),
+ Column("old_flags", types.Unicode),
+ )
+
+
+def categorylinks_table(metadata):
+ """Returns the sqlalchemy Table representing the "categorylinks" table in MediaWiki.
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("categorylinks", metadata,
+ Column("cl_from", types.Integer, nullable=False, primary_key=True),
+ Column("cl_to", types.Unicode(255), nullable=False, primary_key=True),
+ Column("cl_sortkey", types.Unicode, nullable=False),
+ Column("cl_timestamp", types.DateTime, nullable=False),
+ )
+
--- /dev/null
+#!/usr/bin/python2.6
+# -*- coding: iso-8859-15 -*-
+# $Id$
+# $HeadURL$
+"""This module contains code to make tha access of winterrodeln
+tables in MediaWiki easy. The module uses sqlalchemy to access the database.
+"""
+from sqlalchemy import Table, Column, types, schema
+
+
+def wrreport_table(metadata):
+ """Returns the sqlalchemy Table representing the "wrreport" Winterrodeln table in MediaWiki.
+ Current table definition.
+ * version 1.2
+ * version 1.3 (no changes)
+ * version 1.4 (no changes)
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("wrreport", metadata,
+ Column("id", types.Integer, primary_key=True),
+ Column("page_id", types.Integer, schema.ForeignKey('wrsleddingcache.page_id')),
+ Column("page_title", types.Unicode(255), nullable=False),
+ Column("date_report", types.Date),
+ Column("date_entry", types.DateTime, nullable=False),
+ Column("date_invalid", types.DateTime),
+ Column("condition", types.Integer),
+ Column("description", types.Unicode),
+ Column("author_name", types.Unicode(30)),
+ Column("author_ip", types.Unicode(15)),
+ Column("author_userid", types.Integer),
+ Column("author_username", types.Unicode(30)),
+ Column("delete_date", types.DateTime),
+ Column("delete_person_name", types.Unicode(30)),
+ Column("delete_person_ip", types.Unicode(15)),
+ Column("delete_person_userid", types.Integer),
+ Column("delete_person_username", types.Unicode(30)),
+ Column("delete_reason_public", types.Unicode),
+ )
+
+
+def wrsledruncache_table(metadata):
+ """Returns the sqlalchemy Table representing the "wrsledruncache" Winterrodeln table in MediaWiki.
+ Current table definition
+ * version 1.4 (renamed table and added column walkup_possible)
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("wrsledruncache", metadata,
+ Column("page_id", types.Integer, primary_key=True),
+ Column("page_title", types.Unicode(255)),
+ Column("position_latitude", types.Float),
+ Column("position_longitude", types.Float),
+ Column("top_latitude", types.Float),
+ Column("top_longitude", types.Float),
+ Column("top_elevation", types.Integer),
+ Column("bottom_latitude", types.Float),
+ Column("bottom_longitude", types.Float),
+ Column("bottom_elevation", types.Integer),
+ Column("length", types.Integer),
+ Column("difficulty", types.Integer),
+ Column("avalanches", types.Integer),
+ Column("operator", types.Unicode(255)),
+ Column("public_transport", types.Integer),
+ Column("walkup_possible", types.Boolean),
+ Column("walkup_time", types.Integer),
+ Column("walkup_separate", types.Float),
+ Column("walkup_separate_comment", types.Unicode(255)),
+ Column("lift", types.Boolean),
+ Column("lift_details", types.Unicode(255)),
+ Column("night_light", types.Float),
+ Column("night_light_comment", types.Unicode(255)),
+ Column("night_light_days", types.Integer),
+ Column("night_light_days_comment", types.Unicode(255)),
+ Column("sled_rental", types.Boolean),
+ Column("sled_rental_comment", types.Unicode(255)),
+ Column("cachet", types.Unicode(255)),
+ Column("information_web", types.Unicode(255)),
+ Column("information_phone", types.Unicode(255)),
+ Column("image", types.Unicode(255)),
+ Column("show_in_overview", types.Boolean),
+ Column("forum_id", types.Integer),
+ Column("under_construction", types.Boolean),
+ )
+
+
+def wrinncache_table(metadata):
+ """Returns the sqlalchemy Table representing the "wrinncache" Winterrodeln table in MediaWiki.
+ Current table definition
+ * version 1.3 (changes made from version 1.2)
+ * version 1.4 (no changes)
+ :param metadata: metadata = sqlalchemy.MetaData()
+ """
+ return Table("wrinncache", metadata,
+ Column("page_id", types.Integer, primary_key=True),
+ Column("page_title", types.Unicode(255)),
+ Column("position_latitude", types.Float),
+ Column("position_longitude", types.Float),
+ Column("position_elevation", types.Integer),
+ Column("seats", types.Integer),
+ Column("overnight", types.Boolean),
+ Column("overnight_comment", types.Unicode(255)),
+ Column("smoker_area", types.Boolean),
+ Column("nonsmoker_area", types.Boolean),
+ Column("sled_rental", types.Boolean),
+ Column("sled_rental_comment", types.Unicode(255)),
+ Column("mobile_provider", types.Unicode),
+ Column("homepage", types.Unicode(255)),
+ Column("email_list", types.Unicode),
+ Column("phone_list", types.Unicode),
+ Column("image", types.Unicode(255)),
+ Column("sledding_list", types.Unicode),
+ Column("under_construction", types.Boolean),
+ )
+
+