本文整理汇总了Python中Classes.SUDBConnect.SUDBConnect.getRowsDB方法的典型用法代码示例。如果您正苦于以下问题:Python SUDBConnect.getRowsDB方法的具体用法?Python SUDBConnect.getRowsDB怎么用?Python SUDBConnect.getRowsDB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Classes.SUDBConnect.SUDBConnect
的用法示例。
在下文中一共展示了SUDBConnect.getRowsDB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ScholarsiteLeadsGetDatabaseInfo
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
class ScholarsiteLeadsGetDatabaseInfo(object):
def __init__(self):
self.db = SUDBConnect()
def getScholarsiteLeadsIds(self):
scholarsiteLeadsIds = []
rows = self.db.getRowsDB("select * from dbo.ScholarsiteLeads")
for row in rows:
scholarsiteLeadsIds.append(row.ScholarsiteLeadId)
return scholarsiteLeadsIds
def getNames(self):
names = []
rows = self.db.getRowsDB("select * from dbo.ScholarsiteLeads")
for row in rows:
names.append(row.Name)
return names
def getRequirements(self):
requirements = []
rows = self.db.getRowsDB("select * from dbo.ScholarsiteLeads")
for row in rows:
requirements.append(row.Requirements)
return requirements
示例2: InsertUnigoLeadArrayIntoUnigoLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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
示例3: InsertScholarsiteLeadsArrayIntoScholarsiteLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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
示例4: InsertIefaLeadArrayIntoIefaLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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()
示例5: getKeywords
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def getKeywords(tag=None):
db = SUDBConnect()
keywords = []
if tag:
rows = db.getRowsDB("select distinct Keyword from dbo.PivotLeads where Tag='" + tag + "'")
for row in rows:
keywords.append(row.Keyword)
else:
rows = db.getRowsDB("select distinct Keyword from dbo.PivotLeads")
for row in rows:
keywords.append(row.Keyword)
return keywords
示例6: test_ConnectToDBInsertUpdateDelete
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def test_ConnectToDBInsertUpdateDelete(self):
db = SUDBConnect()
rows = db.getRowsDB("select * from dbo.Tests")
self.assertGreater(len(rows), 0)
db.insertUpdateOrDeleteDB("insert into dbo.Tests (Regex, AttributeId) values ('meow', 2)")
rows = db.getRowsDB("select * from dbo.Tests where Regex='meow'")
self.assertGreater(len(rows), 0)
db.insertUpdateOrDeleteDB("update dbo.Tests set Regex='kitty' where Regex='meow'")
rows = db.getRowsDB("select * from dbo.Tests where Regex='kitty'")
self.assertGreater(len(rows), 0)
db.insertUpdateOrDeleteDB("delete from dbo.Tests where Regex='kitty'")
rows = db.getRowsDB("select * from dbo.Tests where Regex='kitty'")
self.assertEqual(len(rows), 0)
示例7: InsertGrantForwardLeadsArrayIntoGrantForwardItems
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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
示例8: InsertFastWebLeadIntoFastWebLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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
示例9: InsertCheggLeadArrayIntoCheggLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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
示例10: useOnlyFirstRegexHelperTrue
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def useOnlyFirstRegexHelperTrue(attributeId, stringToScan):
DB = SUDBConnect()
rows = DB.getRowsDB(' Select ' + str(attributeId) + ' , RegEx, RegExHelper from RegExHelpers')
regExHelper = ''
if len(rows) >= 1:
regExHelper = rows[0].RegExHelper
return Parser(stringToScan, regExHelper).doesMatchExist()
示例11: test_normalRun
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def test_normalRun(self):
# set up
db = SUDBConnect()
sponsorsList = []
descriptionList = []
ocList = []
iefaLeadTrainingIdList = []
actualBad = []
concatenatedDescriptionOCList = []
rows = db.getRowsDB("select * from dbo.IefaLeadsTrainingItems where BadScholarship!='Maybe'")
for row in rows:
sponsorsList.append(row.Sponsor)
descriptionList.append(row.Description)
ocList.append(row.OtherCriteria)
actualBad.append(row.BadScholarship)
iefaLeadTrainingIdList.append(str(row.IefaLeadTrainingId))
for i in range(len(descriptionList)):
conatenatedItem = '%s %s' % (descriptionList[i], ocList[i])
concatenatedDescriptionOCList.append(conatenatedItem)
# test
testNER = ClassifyBadScholarships(sponsorsList, concatenatedDescriptionOCList)
predictedBad = testNER.loopThroughLeadsAndDoStuff()
accuracy = ComputeAccuracy(actualBad, predictedBad).calculateAccuracy()
print(accuracy)
# put result in db
for i in range(len(predictedBad)):
iefaLeadTrainingId = iefaLeadTrainingIdList[i]
predicted = predictedBad[i]
db.insertUpdateOrDeleteDB(
"update dbo.IefaLeadsTrainingItems set NormalTestPredictedTag='" + predicted + "' where IefaLeadTrainingId='" + iefaLeadTrainingId + "'")
示例12: test_infoTextOnlyNoInsert
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def test_infoTextOnlyNoInsert(self):
# set up
db = SUDBConnect()
sponsorsList = []
descriptionList = []
ocList = []
iefaLeadTrainingIdList = []
actualBad = []
concatenatedDescriptionOCList = []
rows = db.getRowsDB("select * from dbo.IefaLeadsTrainingItems where BadScholarship!='Maybe'")
for row in rows:
sponsorsList.append(row.Sponsor)
descriptionList.append(row.Description)
ocList.append(row.OtherCriteria)
actualBad.append(row.BadScholarship)
iefaLeadTrainingIdList.append(str(row.IefaLeadTrainingId))
for i in range(len(descriptionList)):
conatenatedItem = '%s %s' % (descriptionList[i], ocList[i])
concatenatedDescriptionOCList.append(conatenatedItem)
# test
testNER = ClassifyBadScholarships(sponsorsList, concatenatedDescriptionOCList, test='infoTextOnly')
infoTextPredictedBad = testNER.loopThroughLeadsAndDoStuff()
accuracy = ComputeAccuracy(actualBad, infoTextPredictedBad).calculateAccuracy()
print(accuracy)
示例13: test_InsertPivotLeadsArrayIntoPivotLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def test_InsertPivotLeadsArrayIntoPivotLeadsDB(self):
fakepivotleadsarray = ['keyword', 'url', 'name', 'abstract', 'sponsor', 'amount', 'applicant type',
'citizenship residency', 'activity location', 'eligibility', 'categories',
'source website', 'source text']
InsertPivotLeadsArrayIntoPivotLeadsDB(fakepivotleadsarray)
db = SUDBConnect()
rows = db.getRowsDB("select * from dbo.PivotLeads where Url='url'")
self.assertIsNotNone(rows)
self.assertEqual('keyword', rows[0].Keyword)
self.assertEqual('url', rows[0].Url)
self.assertEqual('name', rows[0].Name)
self.assertEqual('abstract', rows[0].Abstract)
self.assertEqual('sponsor', rows[0].Sponsor)
self.assertEqual('amount', rows[0].Amount)
self.assertEqual('applicant type', rows[0].ApplicantType)
self.assertEqual('citizenship residency', rows[0].CitizenshipResidency)
self.assertEqual('activity location', rows[0].ActivityLocation)
self.assertEqual('eligibility', rows[0].Eligibility)
self.assertEqual('categories', rows[0].Categories)
self.assertEqual('source website', rows[0].SourceWebsite)
self.assertEqual('source text', rows[0].SourceText)
db.insertUpdateOrDeleteDB("delete from dbo.PivotLeads where Url='url'")
示例14: InsertFatomeiLeadsArrayIntoFatomeiLeadsDB
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [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
示例15: getAbstracts
# 需要导入模块: from Classes.SUDBConnect import SUDBConnect [as 别名]
# 或者: from Classes.SUDBConnect.SUDBConnect import getRowsDB [as 别名]
def getAbstracts():
db = SUDBConnect()
abstracts = []
rows = db.getRowsDB("select Abstract from dbo.PivotTags")
for row in rows:
abstracts.append(row.Abstract)
return abstracts