(self, tableColumns)
Adds information about the columns of the existing tables to the xml
Adds information about the columns of the existing tables to the xml
Adds information about the columns of the existing tables to the xml
def dbTableColumns(self, tableColumns):
        '''
        Adds information about the columns of the existing tables to the xml
        '''

        columnsElem = self._getRootChild(COLUMNS_ELEM_NAME)
        if not(columnsElem):
            columnsElem = self.__doc.createElement(COLUMNS_ELEM_NAME)

        for db, tables in tableColumns.items():
            if not db:
                db = DEFAULT_DB
            dbElem = self.__doc.createElement(DATABASE_COLUMNS_ELEM)
            dbElem.setAttributeNode(self._createAttribute(NAME_ATTR, db))
            columnsElem.appendChild(dbElem)

            for table, columns in tables.items():
                tableElem = self.__doc.createElement(TABLE_ELEM_NAME)
                tableElem.setAttributeNode(self._createAttribute(NAME_ATTR, table))

                colList = columns.keys()
                colList.sort(key=lambda x: x.lower())

                for column in colList:
                    colType = columns[column]
                    colElem = self.__doc.createElement(COLUMN_ELEM_NAME)
                    if colType is not None:
                        colElem.setAttributeNode(self._createAttribute(TYPE_ATTR, colType))
                    else:
                        colElem.setAttributeNode(self._createAttribute(TYPE_ATTR, UNKNOWN_COLUMN_TYPE))
                    colElem.appendChild(self._createTextNode(column))
                    tableElem.appendChild(colElem)

        self._addToRoot(columnsElem)
def dbTableColumns ( self , tableColumns ) : columnsElem = self . _getRootChild ( COLUMNS_ELEM_NAME ) if not ( columnsElem ) : columnsElem = self . __doc . createElement ( COLUMNS_ELEM_NAME ) for db , tables in tableColumns . items ( ) : if not db : db = DEFAULT_DB dbElem = self . __doc . createElement ( DATABASE_COLUMNS_ELEM ) dbElem . setAttributeNode ( self . _createAttribute ( NAME_ATTR , db ) ) columnsElem . appendChild ( dbElem ) for table , columns in tables . items ( ) : tableElem = self . __doc . createElement ( TABLE_ELEM_NAME ) tableElem . setAttributeNode ( self . _createAttribute ( NAME_ATTR , table ) ) colList = columns . keys ( ) colList . sort ( key = lambda x : x . lower ( ) ) for column in colList : colType = columns [ column ] colElem = self . __doc . createElement ( COLUMN_ELEM_NAME ) if colType is not None : colElem . setAttributeNode ( self . _createAttribute ( TYPE_ATTR , colType ) ) else : colElem . setAttributeNode ( self . _createAttribute ( TYPE_ATTR , UNKNOWN_COLUMN_TYPE ) ) colElem . appendChild ( self . _createTextNode ( column ) ) tableElem . appendChild ( colElem ) self . _addToRoot ( columnsElem )