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

Method _clean_function

src/madpack/upgrade_util.py:1191–1202  ·  view source on GitHub ↗

@brief Remove "drop function" statements and rewrite "create function" statements in the sql script @note We don't drop any function

(self)

Source from the content-addressed store, hash-verified

1189 self._sql = re.sub(regex_pat, '', self._sql)
1190
1191 def _clean_function(self):
1192 """
1193 @brief Remove "drop function" statements and rewrite "create function"
1194 statements in the sql script
1195 @note We don't drop any function
1196 """
1197 # remove 'drop function'
1198 pattern = re.compile(r"""DROP(\s+)FUNCTION(.*?);""", re.DOTALL | re.IGNORECASE)
1199 self._sql = re.sub(pattern, '', self._sql)
1200 # replace 'create function' with 'create or replace function'
1201 pattern = re.compile(r"""CREATE(\s+)FUNCTION""", re.DOTALL | re.IGNORECASE)
1202 self._sql = re.sub(pattern, 'CREATE OR REPLACE FUNCTION', self._sql)
1203
1204 def cleanup(self, sql):
1205 """

Callers 1

cleanupMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected