Description: Python script to parse an xml file which retrieved from a DB table and move its values to selected table in a datawarehouse
Class Name: XML_Query_Helper Functions:
- init(path,...): Create an Elemantary Tree Root by any path or xml script directly
Parameters:
- Depth_key: If there is key word specified, you can choose how deep parser search for columns. Default: 0
- Key_word: Parser use the column by given key_word as base point. Then you can go deeper by using depth_key. Default: "NO_REQUIRED_KEY_WORD"
- columns(): Returns columns of current position in xml file. Youı can use this function to check where parser currently is.
- XML2List(...): Creates two lists (Label Set, Values Set). One stores labels of attributes, other one stores values.
Parameters:
- Column Name: Only selected column of xml is joint into lists.
- Special_key: Only ones satisfy special key (first 2 letters) is joint. Default: "NO_REQUIRED_SPECIAL_KEY"
- Extra Label: Any extra information can be joint. You need to declare them as lists (Extra Label, Extra Values).
- Extra Values
- Target_columns: Only ones which exist in target data warehouse table (XML may have more columns than DWH). Default: "NO_REQUIRED_TARGET_COLUMNS"
- Leaf_node: If XML has string series, you need to set leaf_node True. Default: False
- Leaf_num: How many of these string series will be joint. Default: 0
- Special_col: For any column that you do not want it to be depend on leaf_num.
- All_upper: Convert all label names in XML file to uppercase. Default: False
- Directly_series: Get labels and names directly from data frame series. Default: None
- Name_exchange: If there is difference between source column name and target column name, use this property as [[before,after], [before2,after2]]. Default: None
- XML_Query(id,...): It basically converts given lists to INSERT SQL command.
Parameters:
- Db_id: Source DB's ID.
- Label
- Values
- Target_table: Target table of DWH.
- Db_id_name: Change ID attribute's name in target table. Default: "ID"
- Is_there_id: If it is 0, it means there is no any ID column in target table. So parser do not show ID numbers in query command. Default: 1