def drop_functions(self): """DROP all related functions """ res = 0 for sql in self.sql_drop_functions(): res = res + dbcommands.execute_raw(sql) return res
def drop_triggers(self, name): """DROP related triggers """ res = 0 for sql in self.sql_drop_triggers(name): res = res + dbcommands.execute_raw(sql, self.database) return res
def initialize(self): """Initialize the agregate table with values from source table May be long on huge tables """ sql = self.sql_init() res = dbcommands.execute_raw(sql, database=self.database) return res
def create_functions(self): """Create all functions in the database """ res = 0 for sql in self.sql_create_functions(): if res == 0: res = dbcommands.execute_raw(sql, self.database) return res
def create_trigger(self, sql): """Create a trigger """ if self.verbose > 2: stm = dbcommands.mogrify(sql, database=self.database) sys.stdout.write(stm) res = dbcommands.execute_raw(sql, self.database) return res
def create_table(self): """ table (string) column (string) aggregats (array) Return : - 0 is case of creation + success - 1 if table already exists """ if not self.agg_table_ispresent(): sql = self.sql_create_table() return dbcommands.execute_raw(sql, self.database) else: return 1
def drop_table(self): sql = self.sql_drop_table() return dbcommands.execute_raw(sql)