コード例 #1
0
def drop(simple_name):
# 	con = psycopg2.connect(host=pg_host,database=pg_database, user=pg_user, password=pg_password)
# 	cur = con.cursor()
	for device in devices.listNames():
		cmd = "DROP TABLE temp_" + simple_name + device
# 			print cmd
		commitCommand(cmd)
コード例 #2
0
 def drop(self):
     cmd = "DROP TABLE " + self.table_name
     print cmd
     try:
         postgres.commitCommand(cmd)
     except:
         print "TABLE DOES NOT EXIST"
コード例 #3
0
def create(simple_name):
# 	con = psycopg2.connect(host=pg_host,database=pg_database, user=pg_user, password=pg_password)
# 	cur = con.cursor()
	for device in devices.yieldAll():
# 			print device
		if device[0] in 'web_browser':
			cmd = "create table temp_" + simple_name + device[0] + temp_web_table
			commitCommand(cmd)
# 			cur.execute("create table temp_" + self.simple_name + device[0] + temp_web_table)
# 				print cur.statusmessage
		else:
			cmd = "create table temp_" + simple_name + device[0] + temp__mobile_table
			commitCommand(cmd)
コード例 #4
0
ファイル: servergeo.py プロジェクト: jimmylowell/pyspeed
def drop(sponsor_string, server_id):
    logger = logging.getLogger("pyspeed.Server.dropGeo")
    logger.info("Dropping geo tables for: " + sponsor_string)
    for device in ['web_browser', 'mobile']:
        if device[0] in 'web_browser':
            cmd = "DROP TABLE public.geo_" + str(
                server_id) + "_web_browser CASCADE"
            statusmessage = commitCommand(cmd)
            logger.debug(statusmessage + " " + str(server_id) + "_" +
                         device[0])
        else:
            cmd = "DROP TABLE public.geo_" + str(server_id) + "_mobile CASCADE"
            print cmd
            statusmessage = commitCommand(cmd)
コード例 #5
0
ファイル: servergeo.py プロジェクト: jimmylowell/pyspeed
def create(sponsor_string, server_id):
    logger = logging.getLogger("pyspeed.Server.createGeo")
    logger.info("Creating tables for: " + str(sponsor_string))
    for device in ['web_browser', 'mobile']:
        # 			device = device[0]
        if device in 'web_browser':
            cmd = "create table public.geo_" + str(
                server_id) + "_web_browser" + web_table
            statusmessage = commitCommand(cmd)
            logger.debug(statusmessage + " " + str(server_id) + "_" + device)
        else:
            cmd = "create table public.geo_" + str(
                server_id) + "_mobile" + mobile_table
            statusmessage = commitCommand(cmd)
            logger.debug(statusmessage + " " + str(server_id) + "_" + device)
コード例 #6
0
ファイル: olaptime.py プロジェクト: jimmylowell/pyspeed
def makeTable():
    self.drop()
    commitCommand(makeTableCMD())
    commitCommand(makeIndexes())
コード例 #7
0
def makeTimeTable():
    commitCommand("DROP TABLE olap.datedim")
    commitCommand(makeTableCMD())
    commitCommand(makeIndexes())
コード例 #8
0
def makeFactTable(sponsors):
    commitCommand("DROP TABLE olap.fact")
    commitCommand(makeTableCMD(sponsors))
    commitCommand(makeIndexesCMD())
コード例 #9
0
ファイル: server.py プロジェクト: jimmylowell/pyspeed
 def insertTests(self, simple_sponsor, startdate, enddate):
     for device in ['web_browser', 'mobile']:
         cmd = servergeo.makeInsert("'" + self.server_name + "'",
                                    self.server_id, device, simple_sponsor,
                                    startdate, enddate)
         commitCommand(cmd)
コード例 #10
0
 def addPrimaryKey(self, column):
     cmd = "ALTER TABLE " + self.table_name
     cmd += " ADD PRIMARY KEY (" + column + ")"
     print cmd
     postgres.commitCommand(cmd)
コード例 #11
0
 def buildIndex(self, column):
     cmd = "CREATE INDEX ON "
     cmd += self.table_name + " (" + column + ")"
     print cmd
     postgres.commitCommand(cmd)
コード例 #12
0
 def createTableAs(self, select_statement):
     cmd = "CREATE TABLE " + self.table_name
     print cmd
     cmd += " AS " + select_statement
     postgres.commitCommand(cmd)