Exemplo n.º 1
0
def setupDataResult(columnList, clauseList, dataDict):
    returnList = []

    for x in range(len(columnList)):
        dict = {}
        name = combined.getSingleSettingAsString(columnList[x],
                                                 constants.NAME_SETTING)
        newname = combined.getSingleSettingAsString(columnList[x],
                                                    constants.NEWNAME_SETTING)
        if newname == '' or newname is None:
            newname = name

        if name in dataDict['columnList']:
            dataSet = getDataSet(dataDict, name, clauseList)
            dict['columnName'] = newname
            dict['dataset'] = dataSet
            returnList.append(dict)
            dict = {}

        else:
            print("The column - " + name +
                  " - could not be found. The settings are wrong in files.txt")
            print("Hence, the program will now quit")
            quit()

    return returnList
Exemplo n.º 2
0
def returnDataSet(lines):
    path = combined.getSingleSettingAsString(lines, constants.PATH_SETTING)
    delimeter = combined.getSingleSettingAsString(lines,
                                                  constants.DELIMETER_SETTING)

    dataDict = combined.readCsvFile(constants.FILEFOLDER + '/' + path,
                                    delimeter)
    columnList = getColumnList(lines)
    clauseList = getWhereClauseList(lines)

    dataResult = setupDataResult(columnList, clauseList, dataDict)
    return dataResult
Exemplo n.º 3
0
def getTableName(lineList):
    tableName = combined.getSingleSettingAsString(lineList,
                                                  constants.TABLENAME_SETTING)
    if tableName == '' or tableName == None:
        print("Table name was not set in implementation.txt")
        print("Hence default table name is set (Table_23)")
        tableName = 'Table_23'

    return tableName
Exemplo n.º 4
0
def getWhereClauseList(lines):
    returnList = []

    clauseSetting = combined.getSingleSetting(lines,
                                              constants.WHERECLAUSE_SETTING)
    clauseList = combined.getMultipleSettings(clauseSetting,
                                              constants.CLAUSE_SETTING)

    for clause in clauseList:
        returnList.append({
            'column':
            combined.getSingleSettingAsString(clause,
                                              constants.COLUMN_SETTING),
            'equal':
            combined.getSingleSettingAsString(clause, constants.EQUAL_SETTING)
        })

    return returnList
Exemplo n.º 5
0
def getColumnSettings(lineList):
    returnList = []
    columnTypes = combined.getSingleSetting(lineList,
                                            constants.COLUMN_TYPES_SETTING)
    columns = combined.getMultipleSettings(columnTypes,
                                           constants.COLUMN_SETTING)

    for col in columns:
        dict = {}
        name = combined.getSingleSettingAsString(col, constants.NAME_SETTING)
        type = combined.getSingleSettingAsString(col, constants.TYPE_SETTING)

        dict['name'] = name
        if type != None and type != '':
            dict['type'] = type
        else:
            dict['type'] = DEFAULTCOLUMNSETTING

        returnList.append(dict)

    return returnList