def add_function_mapping(cursor, *args): query = ( "INSERT INTO transform.function_mapping " "(function_name, signature_columns, dest_column) " "VALUES " "(%s, %s, %s) " "RETURNING id") cursor.execute(query, args) id, = cursor.fetchone() return FunctionMapping.load(id)(cursor)