Is there any way to use SQL Views in Drupal Views I have some very tricky reports to develop (with multiple subqueries) and it occurred to me that the Data module would be perfect: I can create my complex queries as SQL Views (I know how to do this), then adopt them with Data and use them as ordinary tables in Views. Perfect!

Except that although you can adopt a SQL View, it won't show up in Drupal Views (apparently because no primary key) and of course you can't add a primary key to a SQL View.

Is there any way round this by using a module to replace the View SQL query? I have searched a lot on the web and cannot get around the problem without coding object PHP which to be honest I find intimidating.
I dont know your use-case. But look at new Raw SQL Query module, and see its attached screenshost(s) for how you define the SELECT queries and the report pages it generates:


  It builds "tables" (mysql views using "CREATE VIEW" statement) based
  on raw sql queries. I would say it is like a lightweight version of a
  materialized views approach. It uses Ctools to manage data storage and
  PHPExcel to export data into a Excel file :) After installation, go to
  admin/config/development/raw_sql_query Do not forget clean cache after
  you store a query.


It sounds like this module is caching the returned data (I'm not 100% sure). But that would be helpful since a mysql view is literally a SELECT query upon every access to the data.