Author: cornmander
Date: Sun May 10 07:49:40 2009
New Revision: 35524

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35524&view=rev
Log:
added incomplete method that will use subsample tables instead of big GAMES 
table


Modified:
    website/stats.wesnoth.org/TODO
    website/stats.wesnoth.org/devdata.sqlite
    website/stats.wesnoth.org/wesstats/controllers.py

Modified: website/stats.wesnoth.org/TODO
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/TODO?rev=35524&r1=35523&r2=35524&view=diff
==============================================================================
--- website/stats.wesnoth.org/TODO (original)
+++ website/stats.wesnoth.org/TODO Sun May 10 07:49:40 2009
@@ -1,3 +1,6 @@
 -change hacked up query syntax into one with variable substitution and 
character escaping
--switch from 10k row DB to huge db
+       mysqldb variable substitution only works correctly for column values - 
may NOT be used on statements, table names
 -make the prototype scale to the huge db
+       finished stubbed out scale_query()
+       include a cron.daily entry that can be used to regenerate the subsamples
+-add new views

Modified: website/stats.wesnoth.org/devdata.sqlite
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/devdata.sqlite?rev=35524&r1=35523&r2=35524&view=diff
==============================================================================
Binary files - no diff available.

Modified: website/stats.wesnoth.org/wesstats/controllers.py
URL: 
http://svn.gna.org/viewcvs/wesnoth/website/stats.wesnoth.org/wesstats/controllers.py?rev=35524&r1=35523&r2=35524&view=diff
==============================================================================
--- website/stats.wesnoth.org/wesstats/controllers.py (original)
+++ website/stats.wesnoth.org/wesstats/controllers.py Sun May 10 07:49:40 2009
@@ -33,6 +33,18 @@
                if not isinstance(l,types.ListType):
                        return [l]
                return l
+
+       def scaled_query(self,curs,query,threshold):
+               #list of all the sample sizes
+               curs.execute("SELECT TABLE_NAME FROM information_schema.tables 
WHERE `TABLE_NAME` REGEXP '^"+configuration.DB_TABLE_PREFIX+"SMPL'")
+               results = curs.fetchall()
+               sizes = []
+               for result in results:
+                       
sizes.append(result[0][len(configuration.DB_TABLE_PREFIX+"SMPL"):])
+               sizes.sort()
+               #try query on all the sample sizes in increasing order until we 
get one that meets the threshold
+               for size in sizes:
+                       pass    
 
        def fconstruct(self,filters,colname,list):
                if list[0] == "all":
@@ -51,14 +63,13 @@
                return filters
                
        @expose(template="wesstats.templates.platform")
-       def platform(self, versions=["all"], **kw):
-               
+       def platform(self, versions=["all"], **kw):     
                #hack to work around how a single value in a GET is interpreted
                versions = Root.listfix(self,versions)
                
                conn = 
MySQLdb.connect(configuration.DB_HOSTNAME,configuration.DB_USERNAME,configuration.DB_PASSWORD,configuration.DB_NAME)
                curs = conn.cursor()
-       
+               Root.scaled_query(self,curs,"a","b")
                filters = ""
 
                filters = Root.fconstruct(self,filters,"version",versions)


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to