# Path: onix/metrics.py
# def victory_chance(r1, d1, r2, d2):
# def gxe(r, d, d0=130.0):
# def skill_chance(r, d, baseline):
# 
# Path: onix/reporting/dao.py
# class ReportingDAO(with_metaclass(abc.ABCMeta, object)):
#     def get_usage_by_species(self, month, metagame, species_lookup,
#                              baseline=1630., min_turns=3):
#     def get_number_of_battles(self, month, metagame, min_turns=3):
#     def get_total_weight(self, month, metagame, baseline=1630., min_turns=3):
# 
# Path: onix/backend/sql/schema.py
# def set_sqlite_pragma(dbapi_connection, connection_record):
# def _ignore_insert(conn, element, multiparams, params):
# def create_tables(engine):


import calendar
import datetime
import sqlalchemy as sa
from future.utils import iteritems
from onix import metrics
from onix.reporting import dao as _dao
from onix.backend.sql import schema
"""DAO implementations for SQL backend"""




class ReportingDAO(_dao.ReportingDAO):
    """
    SQL implementation of ReportingDAO interface

    Args:
        connection (sqlalchemy.engine.base.Connection) :
            connection to the SQL backend
    """
    def __init__(self, connection):
        self.conn = connection

# Path: onix/metrics.py
# def victory_chance(r1, d1, r2, d2):
# def gxe(r, d, d0=130.0):
# def skill_chance(r, d, baseline):
# 
# Path: onix/reporting/dao.py
# class ReportingDAO(with_metaclass(abc.ABCMeta, object)):
#     def get_usage_by_species(self, month, metagame, species_lookup,
#                              baseline=1630., min_turns=3):
#     def get_number_of_battles(self, month, metagame, min_turns=3):
#     def get_total_weight(self, month, metagame, baseline=1630., min_turns=3):
# 
# Path: onix/backend/sql/schema.py
# def set_sqlite_pragma(dbapi_connection, connection_record):
# def _ignore_insert(conn, element, multiparams, params):
# def create_tables(engine):


# Path: onix/backend/sql/dao.py
import calendar
import datetime
import sqlalchemy as sa
from future.utils import iteritems
from onix import metrics
from onix.reporting import dao as _dao
from onix.backend.sql import schema

"""DAO implementations for SQL backend"""




class ReportingDAO(_dao.ReportingDAO):
    """
    SQL implementation of ReportingDAO interface

    Args:
        connection (sqlalchemy.engine.base.Connection) :
            connection to the SQL backend
    """
    def __init__(self, connection):
        self.conn = connection

        self.conn.connection.create_function('weight', 3, metrics.skill_chance)