I'm running into limitations of views. For example, I would like to add additional logic and formatting to a view shown in a block. Is there a good way of taking the existing SQL and formatting from the view to create a custom module?
For example: I want to show a table with taxonomy terms, including their hierarchy. Parent terms will have links to one one, children terms will have links to a different view. For children terms I want to show the number of nodes with that term, the number of comments, etc. This can currently not be done using views or would be rather complex to setup.
Rather than starting from scratch writing a module is there a good way to use a similar view and reuse the query and the formatting?