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


Python SUDBConnect.SUDBConnect类代码示例

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


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

示例1: test_InsertPivotLeadsArrayIntoPivotLeadsDB

    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'")
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:25,代码来源:IntegrationTestInsertPivotLeadsArrayIntoPivotLeadsDB.py

示例2: useOnlyFirstRegexHelperTrue

 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()
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:7,代码来源:DatabaseHelper.py

示例3: test_infoTextOnlyNoInsert

    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)
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:27,代码来源:TestClassifyBadScholarships.py

示例4: test_normalRun

    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 + "'")
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:34,代码来源:TestClassifyBadScholarships.py

示例5: ScholarsiteLeadsGetDatabaseInfo

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
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:30,代码来源:ScholarsiteLeadsGetDatabaseInfo.py

示例6: __init__

    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')
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:27,代码来源:InsertScholarsiteLeadsArrayIntoScholarsiteLeadsDB.py

示例7: doInsert

 def doInsert(GoogleLeadArray):
     db = SUDBConnect()
     title = GoogleLeadArray[0]
     url = GoogleLeadArray[1]
     description = GoogleLeadArray[2]
     db.insertUpdateOrDeleteDB(
         "INSERT INTO dbo.LinkCrawlerHrefs ( QuestionId, LinkUrl, LinkName, LinkDescription, LinkBody, ProcessUsed, IsBadLink, InsertDate, UpdateDate) VALUES  ( 0, '" + url + "', '" + title + "', '" + description + "', '', 0, 0, GETDATE(), GETDATE())")
     return None
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:InsertGoogleLeadArrayToDatabase.py

示例8: getAbstracts

    def getAbstracts():
        db = SUDBConnect()
        abstracts = []

        rows = db.getRowsDB("select Abstract from dbo.PivotTags")
        for row in rows:
            abstracts.append(row.Abstract)
        return abstracts
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:GetPivotTagsTitleAbstractEligibility.py

示例9: getTitles

    def getTitles():
        db = SUDBConnect()
        titles = []

        rows = db.getRowsDB("select Name from dbo.PivotTags")
        for row in rows:
            titles.append(row.Name)
        return titles
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:GetPivotTagsTitleAbstractEligibility.py

示例10: UseOnlyFirstRegex

    def UseOnlyFirstRegex(attributeId, stringToScan):
        DB = SUDBConnect()
        rows = DB.getRowsDB(' Select ' + str(attributeId) + ' , RegEx from RegExHelpers')
        searchCriteria = ''
        if len(rows) >= 1:
            searchCriteria = rows[0].RegEx

        return Parser(stringToScan, searchCriteria).doesMatchExist()
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:DatabaseHelper.py

示例11: getEligibilities

    def getEligibilities():
        db = SUDBConnect()
        eligibilities = []

        rows = db.getRowsDB("select Eligibility from dbo.PivotTags")
        for row in rows:
            eligibilities.append(row.Eligibility)
        return eligibilities
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:GetPivotTagsTitleAbstractEligibility.py

示例12: __init__

 def __init__(self, googleLeadArray):
     self.googleLeadArray = googleLeadArray
     db = SUDBConnect()
     title = self.googleLeadArray[0]
     link = self.googleLeadArray[1]
     description = self.googleLeadArray[2]
     db.insertUpdateOrDeleteDB(
         "INSERT INTO dbo.GoogleLeads (GoogleLeadId, KeyTerm, Title, Link, Description, LinkBody, DateLeadGenerated, DateBodyGenerated) VALUES (0 , '', '" + title + "', '" + link + "', '" + description + "', '', GETDATE(), GETDATE())")
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:InsertGoogleLeadArrayIntoGoogleLeadsDatabase.py

示例13: test_CreateFilePath

 def test_CreateFilePath(self):
     db = SUDBConnect()
     user = 'Kya'
     website = 'KyasCatPage'
     fileName = 'cats.txt'
     filePath = db.createFilePath(user, website, fileName)
     expectedFilePath = 'c:\Cerebro\%s\%s\%s' % (user, website, fileName)
     self.assertEqual(expectedFilePath, filePath)
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:TestSUDBConnect.py

示例14: getTags

    def getTags():
        db = SUDBConnect()
        tags = []

        rows = db.getRowsDB("select Tag from dbo.PivotTags")
        for row in rows:
            tags.append(row.Tag)
        return tags
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:8,代码来源:GetPivotTagsTitleAbstractEligibility.py

示例15: getEmptyTagAbstracts

def getEmptyTagAbstracts():
    db = SUDBConnect()

    emptyTagRows = db.getRowsDB("select * from dbo.PivotTags where ISNULL(Tag, '') = ''")
    emptyTagAbstracts = []
    for row in emptyTagRows:
        emptyTagAbstracts.append(row.Abstract)

    return emptyTagAbstracts
开发者ID:kyajmiller,项目名称:Cerebro,代码行数:9,代码来源:pivottaggingscript.py


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