示例#1
0
 def mysqlQueries(self, name, filePath):
     fileProp = FileProperties(filePath)
     fileQuery = ImportUserProvData(name, filePath, fileProp.varNames,
                                    fileProp.varTypes,
                                    fileProp.varNamesDummy,
                                    fileProp.varTypesDummy)
     return fileQuery
示例#2
0
    def createHousingPUMSTable(self):
        web_stabb = self.project.stateAbb[self.state]
        hMasterFile = self.loc + os.path.sep + 'ss07h%s.csv' %web_stabb

        hMasterVariablesTypes = ['bigint'] * HACS_VARCOUNT
        fileProp = FileProperties(hMasterFile)
        hMasterVariablesTypes = fileProp.varTypes        
        self.processTable(hMasterFile, self.loc)
        
        hMasterPUMSTableQuery = ImportUserProvData("housing_raw", hMasterFile, 
                                                   varTypes=hMasterVariablesTypes, 
                                                   varNamesFileDummy=True, 
                                                   varTypesFileDummy=False)

        if self.checkIfTableExists('housing_raw'):

            if not self.query.exec_(hMasterPUMSTableQuery.query1):
                raise FileError, self.query.lastError().text()

            if not self.query.exec_(hMasterPUMSTableQuery.query2):
                raise FileError, self.query.lastError().text()


        dummyString = ''
        for i in self.housingVariablesSelected:
            dummyString = dummyString + i + ','
            
        dummyString = dummyString[:-1]
        #print dummyString
        
        

        if not self.query.exec_("""create table housing_pums select %s from housing_raw"""
                                %(dummyString)):
            raise FileError, self.query.lastError().text()
示例#3
0
 def mysqlQueries(self, name, filePath):
     # Generate the mysql queries to import the tables
     fileProp = FileProperties(filePath)
     fileQuery = ImportUserProvData(name, filePath, fileProp.varNames,
                                    fileProp.varTypes,
                                    fileProp.varNamesDummy,
                                    fileProp.varTypesDummy)
     return fileQuery
示例#4
0
    def createPersonPUMSTable(self):
        web_stabb = self.project.stateAbb[self.state]
        pMasterFile = self.loc + os.path.sep + 'ss09p%s.csv' %web_stabb

        pMasterVariablesTypes = ['bigint'] * PACS5yr_VARCOUNT

        #print pMasterFile
        fileProp = FileProperties(pMasterFile)
        pMasterVariablesTypes = fileProp.varTypes        
        self.processTable(pMasterFile, self.loc)
        
        pMasterPUMSTableQuery = ImportUserProvData("person_raw", pMasterFile, 
                                                   varTypes=pMasterVariablesTypes, 
                                                   varNamesFileDummy=True, 
                                                   varTypesFileDummy=False)

        import time
        ti = time.time()
        if self.checkIfTableExists('person_raw'):

            if not self.query.exec_(pMasterPUMSTableQuery.query1):
                raise FileError, self.query.lastError().text()

            if not self.query.exec_(pMasterPUMSTableQuery.query2):
                raise FileError, self.query.lastError().text()


        dummyString = ''
        for i in self.personVariablesSelected:
            dummyString = dummyString + i + ','
            
        dummyString = dummyString[:-1]
        #print dummyString

        #print 'time for creating the raw person table - ', time.time()-ti

        ti = time.time()


        if not self.query.exec_("""create table person_pums select %s from person_raw"""
                                %(dummyString)):
            raise FileError, self.query.lastError().text()