Restructure to move redsql functionality into API