当前位置: 首页>>代码示例>>Python>>正文


Python SUDBConnect.writeFile方法代码示例

本文整理汇总了Python中Classes.SUDBConnect.SUDBConnect.writeFile方法的典型用法代码示例。如果您正苦于以下问题:Python SUDBConnect.writeFile方法的具体用法?Python SUDBConnect.writeFile怎么用?Python SUDBConnect.writeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Classes.SUDBConnect.SUDBConnect的用法示例。


在下文中一共展示了SUDBConnect.writeFile方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: InsertUnigoLeadArrayIntoUnigoLeadsDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertUnigoLeadArrayIntoUnigoLeadsDB(object):
    def __init__(self, unigoLeadArray, fundingClassification, badScholarshipClassification):
        self.unigoLeadArray = unigoLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassification = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = self.unigoLeadArray[0]
        self.amount = self.unigoLeadArray[1]
        self.deadline = self.unigoLeadArray[2]
        self.url = self.unigoLeadArray[3]
        self.url = re.sub("'", '', self.url)
        self.sponsor = self.unigoLeadArray[4]
        self.awardAmount = self.unigoLeadArray[5]
        self.recipients = self.unigoLeadArray[6]
        self.requirements = self.unigoLeadArray[7]
        self.additionalInfo = self.unigoLeadArray[8]
        self.contact = self.unigoLeadArray[9]
        self.address = self.unigoLeadArray[10]
        self.deadlineInformation = self.unigoLeadArray[11]
        self.sourceWebsite = self.unigoLeadArray[12]
        self.sourceWebsite = re.sub("'", '', self.sourceWebsite)
        self.sourceText = self.unigoLeadArray[13]
        self.date = time.strftime('%Y%m%d')

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
                "select * from dbo.UnigoLeads where Name='" + self.name + "' and Url='" + self.url + "'")
        # "select * from dbo.UnigoLeads where Name='" + self.name + "' and Url='" + self.url + "'"
        if matchingRow != []:
            return True
        else:
            return False

    def writeFileToDisk(self):
        tableName = 'UnigoLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
                "select * from dbo.UnigoLeads where Name='" + self.name + "' and Url='" + self.url + "'")[
            0]
        # "select * from dbo.UnigoLeads where Name='" + self.name + "' and Url='" + self.url + "'"
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.url, self.date)

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                    "INSERT INTO dbo.UnigoLeads (Name, Amount, Deadline, Url, Sponsor, AwardAmount, Recipients, Requirements, AdditionalInfo, Contact, Address, DeadlineInformation, SourceWebsite, SourceText, Tag, BadScholarship, Date) VALUES (N'" + self.name + "', N'" + self.amount + "', N'" + self.deadline + "', N'" + self.url + "', N'" + self.sponsor + "', N'" + self.awardAmount + "', N'" + self.recipients + "', N'" + self.requirements + "', N'" + self.additionalInfo + "', N'" + self.contact + "', N'" + self.address + "', N'" + self.deadlineInformation + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', N'" + self.fundingClassification + "', N'" + self.badScholarshipClassification + "', '" + self.date + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "UPDATE dbo.UnigoLeads SET Amount=N'" + self.amount + "', Deadline=N'" + self.deadline + "', Sponsor=N'" + self.sponsor + "', AwardAmount=N'" + self.awardAmount + "', Recipients=N'" + self.recipients + "', Requirements=N'" + self.requirements + "', AdditionalInfo=N'" + self.additionalInfo + "', Contact=N'" + self.contact + "', Address=N'" + self.address + "', DeadlineInformation=N'" + self.deadlineInformation + "', SourceWebsite=N'" + self.sourceWebsite + "', SourceText=N'" + self.sourceText + "', Tag=N'" + self.fundingClassification + "', BadScholarship=N'" + self.badScholarshipClassification + "', Date='" + self.date + "' WHERE Name=N'" + self.name + "' AND Url='" + self.url + "'")
            # UPDATE dbo.UnigoLeads SET Amount=N'" + self.amount + "', Deadline=N'" + self.deadline + "', Url='" + self.url + "', Sponsor=N'" + self.sponsor + "', AwardAmount=N'" + self.awardAmount + "', Recipients=N'" + self.recipients + "', Requirements=N'" + self.requirements + "', AdditionalInfo=N'" + self.additionalInfo + "', Contact=N'" + self.contact + "', Address=N'" + self.address + "', DeadlineInformation=N'" + self.deadlineInformation + "', SourceText=N'" + self.sourceText + "', Tag=N'" + self.fundingClassification + "', BadScholarship=N'" + self.badScholarshipClassification + "', Date='" + self.date + "' WHERE Name=N'" + self.name + "' AND SourceWebsite=N'" + self.sourceWebsite + "'
            # UPDATE dbo.UnigoLeads SET Amount=N'" + self.amount + "', Deadline=N'" + self.deadline + "', Sponsor=N'" + self.sponsor + "', AwardAmount=N'" + self.awardAmount + "', Recipients=N'" + self.recipients + "', Requirements=N'" + self.requirements + "', AdditionalInfo=N'" + self.additionalInfo + "', Contact=N'" + self.contact + "', Address=N'" + self.address + "', DeadlineInformation=N'" + self.deadlineInformation + "', SourceWebsite=N'" + self.sourceWebsite + "', SourceText=N'" + self.sourceText + "', Tag=N'" + self.fundingClassification + "', BadScholarship=N'" + self.badScholarshipClassification + "', Date='" + self.date + "' WHERE Name=N'" + self.name + "' AND Url=N'" + self.url + "'
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:61,代码来源:InsertUnigoLeadArrayIntoUnigoLeadsDB.py

示例2: test_writeFile

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
 def test_writeFile(self):
     db = SUDBConnect(destination='filesystem')
     columns = ['animal', 'name']
     values = ['kitty', 'guen']
     user = 'Kya'
     website = 'KyasTestWebsite'
     url = 'www.kyastestwebsite.com'
     date = '20151204'
     db.writeFile(columns, values, user, website, url, date)
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:11,代码来源:TestSUDBConnect.py

示例3: InsertScholarsiteLeadsArrayIntoScholarsiteLeadsDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertScholarsiteLeadsArrayIntoScholarsiteLeadsDB(object):
    def __init__(self, scholarsiteLeadArray, fundingClassification, badScholarshipClassification):
        self.scholarsiteLeadArray = scholarsiteLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassificaion = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = self.scholarsiteLeadArray[0]
        self.amount = self.scholarsiteLeadArray[1]
        self.deadline = self.scholarsiteLeadArray[2]
        self.requirements = self.scholarsiteLeadArray[3]
        self.annualAwards = self.scholarsiteLeadArray[4]
        self.major = self.scholarsiteLeadArray[5]
        self.academicLevel = self.scholarsiteLeadArray[6]
        self.qualifiedMinorities = self.scholarsiteLeadArray[7]
        self.eligibleInstitution = self.scholarsiteLeadArray[8]
        self.eligibleRegion = self.scholarsiteLeadArray[9]
        self.usCitizen = self.scholarsiteLeadArray[10]
        self.usResident = self.scholarsiteLeadArray[11]
        self.foreignNational = self.scholarsiteLeadArray[12]
        self.minimumAge = self.scholarsiteLeadArray[13]
        self.maximumAge = self.scholarsiteLeadArray[14]
        self.classRank = self.scholarsiteLeadArray[15]
        self.minimumGPA = self.scholarsiteLeadArray[16]
        self.minimumACT = self.scholarsiteLeadArray[17]
        self.minimumSAT = self.scholarsiteLeadArray[18]
        self.date = time.strftime('%Y%m%d')

    def checkIfAlreadyInDB(self):
        matchingRow = self.db.getRowsDB(
                "select * from dbo.ScholarsiteLeads where Name='" + self.name + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def writeFileToDisk(self):
        tableName = 'ScholarsiteLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
                "select * from dbo.ScholarsiteLeads where Name='" + self.name + "'")[0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, '', self.date)

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDB():
            self.db.insertUpdateOrDeleteDB(
                    "insert into dbo.ScholarsiteLeads (Name, Amount, Deadline, Requirements, AnnualAwards, Major, AcademicLevel, QualifiedMinorities, EligibleInstitution, EligibleRegion, USCitizen, USResident, ForeignNational, MinimumAge, MaximumAge, ClassRank, MinimumGPA, MinimumACT, MinimumSAT, Tag, BadScholarship, Date) values (N'" + self.name + "', N'" + self.amount + "', '" + self.deadline + "', N'" + self.requirements + "', N'" + self.annualAwards + "', N'" + self.major + "', N'" + self.academicLevel + "', N'" + self.qualifiedMinorities + "', N'" + self.eligibleInstitution + "', N'" + self.eligibleRegion + "', N'" + self.usCitizen + "', N'" + self.usResident + "', N'" + self.foreignNational + "', '" + self.minimumAge + "', '" + self.maximumAge + "', N'" + self.classRank + "', N'" + self.minimumGPA + "', N'" + self.minimumACT + "', N'" + self.minimumSAT + "', N'" + self.fundingClassification + "', '" + self.badScholarshipClassificaion + "', '" + self.date + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.ScholarsiteLeads set Amount=N'" + self.amount + "', Deadline=N'" + self.deadline + "', Requirements=N'" + self.requirements + "', AnnualAwards='" + self.annualAwards + "', Major='" + self.major + "', AcademicLevel=N'" + self.academicLevel + "', QualifiedMinorities=N'" + self.qualifiedMinorities + "', EligibleInstitution=N'" + self.eligibleInstitution + "', EligibleRegion=N'" + self.eligibleRegion + "', USCitizen='" + self.usCitizen + "', USResident='" + self.usResident + "', ForeignNational='" + self.foreignNational + "', MinimumAge='" + self.minimumAge + "', MaximumAge='" + self.maximumAge + "', ClassRank='" + self.classRank + "', MinimumGPA='" + self.minimumGPA + "', MinimumACT='" + self.minimumACT + "', MinimumSAT='" + self.minimumSAT + "', Tag='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassificaion + "', Date='" + self.date + "' where Name='" + self.name + "'")
            self.insertUpdateLead()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:59,代码来源:InsertScholarsiteLeadsArrayIntoScholarsiteLeadsDB.py

示例4: test_CGRLLFileCreationWhyDoesItSuck

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
 def test_CGRLLFileCreationWhyDoesItSuck(self):
     db = SUDBConnect(destination='filesystem')
     columns = ['sponsor']
     values = ['BMI Foundation, Inc']
     user = 'Kya'
     website = 'CollegeGreenLight'
     url = 'https://www.collegegreenlight.com/scholarship/listings/BMI-Student-Composer-Awards/-s-d-49468/?sortBy=&reverse=false'
     # url = 'https://www.collegegreenlight.com/scholarship/listings/BMI-Student-Composer-Awards/-s-d-49468/?'
     date = '20150000'
     db.writeFile(columns, values, user, website, url, date)
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:12,代码来源:TestSUDBConnect.py

示例5: InsertIefaLeadArrayIntoIefaLeadsDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertIefaLeadArrayIntoIefaLeadsDB(object):
    def __init__(self, iefaLeadArray, fundingClassification, badScholarshipClassification):
        self.iefaLeadArray = iefaLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassificaion = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = self.iefaLeadArray[0]
        self.url = self.iefaLeadArray[1]
        self.url = CleanText.replaceSingleQuotesWithTwoSingleQuotes(self.url)
        self.sponsor = self.iefaLeadArray[2]
        self.submissionDeadline = self.iefaLeadArray[3]
        self.majors = self.iefaLeadArray[4]
        self.amount = self.iefaLeadArray[5]
        self.description = self.iefaLeadArray[6]
        self.otherCriteria = self.iefaLeadArray[7]
        self.numberAwards = self.iefaLeadArray[8]
        self.hostInstitution = self.iefaLeadArray[9]
        self.includes = self.iefaLeadArray[10]
        self.nationalityRequired = self.iefaLeadArray[11]
        self.hostCountries = self.iefaLeadArray[12]
        self.sourceWebsite = self.iefaLeadArray[13]
        self.sourceText = self.iefaLeadArray[14]
        self.date = time.strftime('%Y%m%d')

    def writeFileToDisk(self):
        tableName = 'IefaLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
            "select * from dbo.IefaLeads where Name='" + self.name + "' and Url='" + self.url + "'")[0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.url, self.date)

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
            "select * from dbo.IefaLeads where Name='" + self.name + "' and Url='" + self.url + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                    "INSERT INTO dbo.IefaLeads (Name, Url, Sponsor, SubmissionDeadline, Majors, Amount, Description, OtherCriteria, NumberAwards, HostInstitution, Includes, NationalityRequired, HostCountries, SourceWebsite, SourceText, Date, Tag, BadScholarship) VALUES  (N'" + self.name + "', N'" + self.url + "', N'" + self.sponsor + "', N'" + self.submissionDeadline + "', N'" + self.majors + "', N'" + self.amount + "', N'" + self.description + "', N'" + self.otherCriteria + "', N'" + self.numberAwards + "', N'" + self.hostInstitution + "', N'" + self.includes + "', N'" + self.nationalityRequired + "', N'" + self.hostCountries + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', '" + self.date + "', '" + self.fundingClassification + "', '" + self.badScholarshipClassificaion + "')")
            self.writeFileToDisk()
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.IefaLeads set Sponsor=N'" + self.sponsor + "', SubmissionDeadline=N'" + self.submissionDeadline + "', Majors=N'" + self.majors + "', Amount=N'" + self.amount + "', Description=N'" + self.description + "', OtherCriteria=N'" + self.otherCriteria + "', NumberAwards=N'" + self.numberAwards + "', HostInstitution=N'" + self.hostInstitution + "', Includes=N'" + self.includes + "', NationalityRequired=N'" + self.nationalityRequired + "', HostCountries=N'" + self.hostCountries + "', SourceWebsite=N'" + self.sourceWebsite + "', SourceText=N'" + self.sourceText + "', Date='" + self.date + "', Tag='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassificaion + "' where Name='" + self.name + "' and Url='" + self.url + "'")
            self.writeFileToDisk()
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:54,代码来源:InsertIefaLeadArrayIntoIefaLeadsDB.py

示例6: InsertGrantForwardLeadsArrayIntoGrantForwardItems

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertGrantForwardLeadsArrayIntoGrantForwardItems(object):
    def __init__(self, grantForwardLeadArray, fundingClassification, badScholarshipClassification):
        self.grantForwardLeadArray = grantForwardLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassification = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.keyword = self.grantForwardLeadArray[0]
        self.url = self.grantForwardLeadArray[1]
        self.name = self.grantForwardLeadArray[2]
        self.description = self.grantForwardLeadArray[3]
        self.sponsor = self.grantForwardLeadArray[4]
        self.amount = self.grantForwardLeadArray[5]
        self.eligibility = self.grantForwardLeadArray[6]
        self.submissionInfo = self.grantForwardLeadArray[7]
        self.categories = self.grantForwardLeadArray[8]
        self.sourceWebsite = self.grantForwardLeadArray[9]
        self.sourceText = self.grantForwardLeadArray[10]
        self.deadline = self.grantForwardLeadArray[11]
        self.date = time.strftime('%Y%m%d')

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
                "select * from dbo.GrantForwardLeads where Keyword='" + self.keyword + "' and Url='" + self.url + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def writeFileToDisk(self):
        tableName = 'GrantForwardLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
                "select * from dbo.GrantForwardLeads where Keyword='" + self.keyword + "' and Url='" + self.url + "'")[
            0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.url, self.date)

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                "INSERT INTO dbo.GrantForwardLeads (Name, Url, Keyword, Description, Sponsor, Amount, Eligibility, SubmissionInfo, Categories, SourceWebsite, SourceText, Deadline, FundingClassification, BadScholarship, Date) VALUES (N'" + self.name + "', N'" + self.url + "', N'" + self.keyword + "', N'" + self.description + "', N'" + self.sponsor + "', N'" + self.amount + "', N'" + self.eligibility + "', N'" + self.submissionInfo + "', N'" + self.categories + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', N'" + self.deadline + "', N'" + self.fundingClassification + "', N'" + self.badScholarshipClassification + "', '" + self.date + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.GrantForwardLeads set Name=N'" + self.name + "', Description=N'" + self.description + "', Sponsor=N'" + self.sponsor + "', Amount=N'" + self.amount + "', Eligibility=N'" + self.eligibility + "', SubmissionInfo=N'" + self.submissionInfo + "', Categories=N'" + self.categories + "', SourceWebsite='" + self.sourceWebsite + "', SourceText=N'" + self.sourceText + "', Deadline=N'" + self.deadline + "', FundingClassification='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassification + "', Date='" + self.date + "' where Keyword='" + self.keyword + "' and Url='" + self.url + "'")
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:53,代码来源:InsertGrantForwardLeadsArrayIntoGrantForwardItems.py

示例7: InsertFastWebLeadIntoFastWebLeadsDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertFastWebLeadIntoFastWebLeadsDB(object):
    def __init__(self, fastWebLeadArray, fundingClassification, badScholarshipClassification):
        self.badScholarshipClassification = badScholarshipClassification
        self.fundingClassification = fundingClassification
        self.fastWebLeadArray = fastWebLeadArray
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = self.fastWebLeadArray[0]
        self.url = self.fastWebLeadArray[1]
        self.sponsor = self.fastWebLeadArray[2]
        self.amount = self.fastWebLeadArray[3]
        self.deadline = self.fastWebLeadArray[4]
        self.description = self.fastWebLeadArray[5]
        self.awardType = self.fastWebLeadArray[6]
        self.numAwards = self.fastWebLeadArray[7]
        self.majors = self.fastWebLeadArray[8]
        self.additionalInfo = self.fastWebLeadArray[9]
        self.sourceWebsite = self.fastWebLeadArray[10]
        self.sourceText = self.fastWebLeadArray[11]
        self.date = time.strftime('%Y%m%d')

    def writeFileToDisk(self):
        tableName = 'FastWebLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
            "select * from dbo.FastWebLeads where Name='" + self.name + "' and Url='" + self.url + "'")[0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.url, self.date)

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
            "select * from dbo.FastWebLeads where Name='" + self.name + "' and Url='" + self.url + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                    "insert into dbo.FastWebLeads (Name, Url, Sponsor, Amount, Deadline, Description, AwardType, NumAwards, Majors, AdditionalInfo, SourceWebsite, SourceText, Date, Tag, BadScholarship) values (N'" + self.name + "', N'" + self.url + "', N'" + self.sponsor + "', N'" + self.amount + "', N'" + self.deadline + "', N'" + self.description + "', N'" + self.awardType + "', N'" + self.numAwards + "', N'" + self.majors + "', N'" + self.additionalInfo + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', '" + self.date + "', '" + self.fundingClassification + "', '" + self.badScholarshipClassification + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.FastWebLeads set Sponsor='" + self.sponsor + "', Amount='" + self.amount + "', Deadline='" + self.deadline + "', Description='" + self.description + "', AwardType='" + self.awardType + "', NumAwards='" + self.numAwards + "', Majors='" + self.majors + "', AdditionalInfo='" + self.additionalInfo + "', SourceWebsite='" + self.sourceWebsite + "', SourceText='" + self.sourceText + "', Date='" + self.date + "', Tag='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassification + "' where Name='" + self.name + "' and Url='" + self.url + "'")
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:52,代码来源:InsertFastWebLeadsIntoFastWebLeadsDB.py

示例8: InsertCheggLeadArrayIntoCheggLeadsDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertCheggLeadArrayIntoCheggLeadsDB(object):
    def __init__(self, cheggLeadArray, fundingClassification, badScholarshipClassification):
        self.cheggLeadArray = cheggLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassificaion = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = self.cheggLeadArray[0]
        self.url = self.cheggLeadArray[1]
        self.deadline = self.cheggLeadArray[2]
        self.amount = self.cheggLeadArray[3]
        self.eligibility = self.cheggLeadArray[4]
        self.applicationOverview = self.cheggLeadArray[5]
        self.description = self.cheggLeadArray[6]
        self.sponsor = self.cheggLeadArray[7]
        self.sourceWebsite = self.cheggLeadArray[8]
        self.sourceText = self.cheggLeadArray[9]
        self.date = time.strftime('%Y%m%d')

    def writeFileToDisk(self):
        tableName = 'CheggLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
            "select * from dbo.CheggLeads where Name='" + self.name + "' and Url='" + self.url + "'")[0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.url, self.date)

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
            "select * from dbo.CheggLeads where Name='" + self.name + "' and Url='" + self.url + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                    "insert into dbo.CheggLeads (Name, Url, Deadline, Amount, Eligibility, ApplicationOverview, Description, Sponsor, SourceWebsite, SourceText, Date, Tag, BadScholarship) values (N'" + self.name + "', N'" + self.url + "', N'" + self.deadline + "', N'" + self.amount + "', N'" + self.eligibility + "', N'" + self.applicationOverview + "', N'" + self.description + "', N'" + self.sponsor + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', '" + self.date + "', '" + self.fundingClassification + "', '" + self.badScholarshipClassificaion + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.CheggLeads set Deadline=N'" + self.deadline + "', Amount=N'" + self.amount + "', Eligibility=N'" + self.eligibility + "', ApplicationOverview=N'" + self.applicationOverview + "', Description=N'" + self.description + "', Sponsor=N'" + self.sponsor + "', SourceWebsite=N'" + self.sourceWebsite + "', SourceText=N'" + self.sourceText + "', Date='" + self.date + "', Tag='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassificaion + "' where Name='" + self.name + "' and Url='" + self.url + "'")
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:50,代码来源:InsertCheggLeadArrayIntoCheggLeadsDB.py

示例9: InsertFatomeiLeadsArrayIntoFatomeiLeadsDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertFatomeiLeadsArrayIntoFatomeiLeadsDB(object):
    def __init__(self, fatomeiLeadArray, fundingClassification, badScholarshipClassification):
        self.badScholarshipClassification = badScholarshipClassification
        self.fundingClassification = fundingClassification
        self.fatomeiLeadArray = fatomeiLeadArray
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = fatomeiLeadArray[0]
        self.description = fatomeiLeadArray[1]
        self.dueDate = fatomeiLeadArray[2]
        self.sourceWebsite = fatomeiLeadArray[3]
        self.sourceText = fatomeiLeadArray[4]
        self.date = time.strftime('%Y%m%d')

    def writeFileToDisk(self):
        tableName = 'FatomeiLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        try:
            currentRow = self.db.getRowsDB(
                "select * from dbo.FatomeiLeads where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")[
                0]
            self.fileSystemDB.writeFile(columns, currentRow, user, website, self.sourceWebsite, self.date)
        except IndexError:
            pass

    def checkIfAlreadyInDB(self):
        matchingRow = self.db.getRowsDB(
                "SELECT * FROM dbo.FatomeiLeads WHERE Name='" + self.name + "' AND SourceWebsite='" + self.sourceWebsite + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDB():
            self.db.insertUpdateOrDeleteDB(
                "INSERT INTO dbo.FatomeiLeads (Name, Description, DueDate, SourceWebsite, SourceText, Tag, BadScholarship, Date) VALUES (N'" + self.name + "', N'" + self.description + "', N'" + self.dueDate + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', N'" + self.fundingClassification + "', N'" + self.badScholarshipClassification + "', '" + self.date + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                "UPDATE dbo.FatomeiLeads SET Description='" + self.description + "', DueDate='" + self.dueDate + "', SourceText='" + self.sourceText + "', Tag='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassification + "', Date='" + self.date + "' WHERE Name='" + self.name + "' AND SourceWebsite='" + self.sourceWebsite + "'")
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:49,代码来源:InsertFatomeiLeadsArrayIntoFatomeiLeadsDB.py

示例10: InsertMastersInEducationArrayIntoDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertMastersInEducationArrayIntoDB(object):
    def __init__(self, mastersInEducationLeadArray, fundingClassification, badScholarshipClassification):
        self.mastersInEducationLeadArray = mastersInEducationLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassificaion = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = mastersInEducationLeadArray[0]
        self.amount = mastersInEducationLeadArray[1]
        self.deadline = mastersInEducationLeadArray[2]
        self.description = mastersInEducationLeadArray[3]
        self.sourceWebsite = mastersInEducationLeadArray[4]
        self.sourceText = mastersInEducationLeadArray[5]
        self.date = time.strftime('%Y%m%d')

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
                "select * from dbo.MastersInEducationLeads where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def writeFileToDisk(self):
        tableName = 'MastersInEducationLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
                "select * from dbo.MastersInEducationLeads where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")[
            0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.sourceWebsite, self.date)

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                    "INSERT INTO dbo.MastersInEducationLeads (Name, Deadline, Amount, Description, SourceWebsite, SourceText, Tag, BadScholarship, Date) VALUES (N'" + self.name + "', N'" + self.deadline + "', N'" + self.amount + "', N'" + self.description + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', '" + self.fundingClassification + "', '" + self.badScholarshipClassificaion + "', '" + self.date + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.MastersInEducationLeads set Deadline='" + self.deadline + "', Amount='" + self.amount + "', Description='" + self.description + "', SourceText='" + self.sourceText + "', Tag='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassificaion + "', Date='" + self.date + "' where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:47,代码来源:InsertMastersInEducationArrayIntoDB.py

示例11: InsertTeacherDotOrgLeadArrayIntoTeacherDotOrgDB

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class InsertTeacherDotOrgLeadArrayIntoTeacherDotOrgDB(object):
    def __init__(self, teacherDotOrgLeadArray, fundingClassification, badScholarshipClassification):
        self.teacherDotOrgLeadArray = teacherDotOrgLeadArray
        self.fundingClassification = fundingClassification
        self.badScholarshipClassification = badScholarshipClassification
        self.db = SUDBConnect()
        self.fileSystemDB = SUDBConnect(destination='filesystem')

        self.name = teacherDotOrgLeadArray[0]
        self.description = teacherDotOrgLeadArray[1]
        self.requirements = teacherDotOrgLeadArray[2]
        self.sourceWebsite = teacherDotOrgLeadArray[3]
        self.sourceText = teacherDotOrgLeadArray[4]
        self.date = time.strftime('%Y%m%d')

    def writeFileToDisk(self):
        tableName = 'TeacherDotOrgLeads'
        user = 'Kya'
        website = re.sub('Leads', '', tableName)
        columns = self.db.getColumnNamesFromTable(tableName)
        currentRow = self.db.getRowsDB(
                "select * from dbo.TeacherDotOrgLeads where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")[
            0]
        self.fileSystemDB.writeFile(columns, currentRow, user, website, self.sourceWebsite, self.date)

    def checkIfAlreadyInDatabase(self):
        matchingRow = self.db.getRowsDB(
                "select * from dbo.TeacherDotOrgLeads where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")
        if matchingRow != []:
            return True
        else:
            return False

    def insertUpdateLead(self):
        if not self.checkIfAlreadyInDatabase():
            self.db.insertUpdateOrDeleteDB(
                    "insert into dbo.TeacherDotOrgLeads (Name, Description, Requirements, SourceWebsite, SourceText, FundingClassification, BadScholarship, Date) values (N'" + self.name + "', N'" + self.description + "', N'" + self.requirements + "', N'" + self.sourceWebsite + "', N'" + self.sourceText + "', N'" + self.fundingClassification + "', N'" + self.badScholarshipClassification + "', '" + self.date + "')")
            self.writeFileToDisk()
            return True
        else:
            self.db.insertUpdateOrDeleteDB(
                    "update dbo.TeacherDotOrgLeads set Description='" + self.description + "', Requirements='" + self.requirements + "', SourceText='" + self.sourceText + "', FundingClassification='" + self.fundingClassification + "', BadScholarship='" + self.badScholarshipClassification + "', Date='" + self.date + "' where Name='" + self.name + "' and SourceWebsite='" + self.sourceWebsite + "'")
            self.writeFileToDisk()
            return False
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:46,代码来源:InsertTeacherDotOrgLeadArrayIntoTeacherDotOrgDB.py

示例12: WriteTablesToDisk

# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import writeFile [as 别名]
class WriteTablesToDisk(object):
    def __init__(self, tableName, user='Kya'):
        self.tableName = tableName
        self.user = user
        self.website = re.sub('Leads', '', self.tableName)
        self.sqlDB = SUDBConnect(destination='database')
        self.fileDB = SUDBConnect(destination='filesystem')
        self.columns = self.sqlDB.getColumnNamesFromTable(self.tableName)
        self.rows = self.sqlDB.getRowsDB("select * from dbo.%s" % self.tableName)
        self.urls = self.getUrls()

        for row, url in zip(self.rows, self.urls):
            values = row
            self.fileDB.writeFile(self.columns, values, self.user, self.website, url)

    def getUrls(self):
        urls = []
        for row in self.rows:
            try:
                urls.append(row.Url)
            except:
                urls.append(row.SourceWebsite)
        return urls
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:25,代码来源:WriteTablesToDisk.py


注:本文中的Classes.SUDBConnect.SUDBConnect.writeFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。