You should change your method signature to:
public List<database_ab> getData(Query query)</database_ab>
Then change your return statement to
return data.ToList();
Your issue is that Any() returns a bool to see if there are any entries in your collection that match your query.
By making those changes you should get a list that contains 0 or more entries based on the success and failures of your other queries.