@brief Remove "drop function" statements and rewrite "create function" statements in the sql script @note We don't drop any function
(self)
| 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 | """ |