Add retry to sql format