convert sqlite db to treemap  with query