MCPcopy Create free account
hub / github.com/apache/madlib / ChangeHandler

Class ChangeHandler

src/madpack/upgrade_util.py:88–388  ·  view source on GitHub ↗

@brief This class reads changes from the configuration file and handles the dropping of objects

Source from the content-addressed store, hash-verified

86
87
88class ChangeHandler(UpgradeBase):
89 """
90 @brief This class reads changes from the configuration file and handles
91 the dropping of objects
92 """
93 def __init__(self, schema, portid, con_args, maddir, mad_dbrev, is_hawq2):
94 UpgradeBase.__init__(self, schema, portid, con_args)
95 self._maddir = maddir
96 self._mad_dbrev = mad_dbrev
97 self._is_hawq2 = is_hawq2
98 self._newmodule = {}
99 self._udt = {}
100 self._udf = {}
101 self._uda = {}
102 self._udc = {}
103 self._udo = {}
104 self._udoc = {}
105 self._load()
106
107 def _load_config_param(self, config_iterable):
108 """
109 Replace schema_madlib with the appropriate schema name and
110 make all function names lower case to ensure ease of comparison.
111
112 Args:
113 @param config_iterable is an iterable of dictionaries, each with
114 key = object name (eg. function name) and value = details
115 for the object. The details for the object are assumed to
116 be in a dictionary with following keys:
117 rettype: Return type
118 argument: List of arguments
119
120 Returns:
121 A dictionary that lists all specific objects (functions, aggregates, etc)
122 with object name as key and a list as value, where the list
123 contains all the items present in
124
125 another dictionary with objects details
126 as the value.
127 """
128 _return_obj = defaultdict(list)
129 if config_iterable is not None:
130 for each_config in config_iterable:
131 for obj_name, obj_details in each_config.iteritems():
132 formatted_obj = {}
133 for k, v in obj_details.items():
134 v = v.lower().replace('schema_madlib', self._schema)
135 formatted_obj[k] = v
136 _return_obj[obj_name].append(formatted_obj)
137 return _return_obj
138
139 def _load(self):
140 """
141 @brief Load the configuration file
142 """
143 # _mad_dbrev = 1.0
144 if self._mad_dbrev.split('.') < '1.1'.split('.'):
145 filename = os.path.join(self._maddir, 'madpack',

Callers 1

_db_upgradeFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected