- 
                Notifications
    
You must be signed in to change notification settings  - Fork 19
 
Add support for Airport CREATE VIEW statement #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add support for Airport CREATE VIEW statement #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for this contribution! I really appreciate you taking the time to work on this - it's exactly the kind of collaboration that makes this project better. I'm excited to get this feature merged soon.
I wanted to share a few ideas for how we might build on this:
- Right now the code works beautifully when users create views within their session, though those views are session-specific. It would be great to extend this so the server can include existing views when responding to 
list_schemascalls. - We should store views in their own catalog collection, separate from tables. This could make schema lookups more intuitive and organized.
 - The question of server-side materialization is an interesting one - ultimately that's a server decision, though it would be helpful if DuckDB could provide hints about materialization preferences. I'm happy to leave that as a potential enhancement for the team to explore down the road.
 
Thanks again for getting this started - looking forward getting completed after some travel today.
| 
           Hey @dforsber, I was reading and thinking about this PR on my flight this morning and wanted to share some thoughts. It hit me a few lines into working on the merge that this PR is really centered around materialized views—as opposed to the traditional (non-materialized) views that DuckDB supports. In DuckDB, views aren’t materialized and are typically a different type of object in the catalog. The objects you’re creating here behave more like tables, which is great—it just shifts the mental model a bit. Long-term, I’d love for Airport to support both kinds of views. I actually have some ideas around materialized views that could be interesting in other Query.Farm extensions too. Right now though, overloading  I’m not at all opposed to extending the DuckDB parser—I just haven’t done it yet in Airport. I plan to take a look at the flockmtl extension soon since I believe they’ve gone down this path and might offer some good examples. As for this PR specifically, I’ll need a little time before I can fully dive back into it—I have a few commercial priorities I need to get through first at Query.Farm. Here’s where I think we should head next: 
 Really appreciate your work on this PR this is super valuable functionality and I’m excited about where we can take it!  | 
    
| 
           👍🏻 Yes, I think the cleanest way forward is normal VIEW support for Airport, along with DROP VIEW. This PR was my quick AI assisted way forward for supporting VIEW creation with Airport in a way that the FlightRPC server can get the information, along with DROP. I need to dig deeper into the extension to see how to implement the  I noticed that the DuckDB catalog and then the remove FlightRPC server returned catalog information (  | 
    
| 
           I was also thinking it would be nice to be able to create remote views in my Flight server. In my case, these would be views on SQL Server. Currently, this can't work as I would like because I want to reference SQL Server-specific functions in the view, which DuckDB could not parse unless I map them 1:1 as functions in Airport/DuckDB. However, I would not want to map the complete set of SQL Server functions to DuckDB. 
  | 
    
| 
           @rustyconover Feel free to close this PR, thank you.  | 
    
Support for CREATE VIEW
This PR adds support for CREATE VIEW statements on the Airport extension.
Motivation
I would like to add support for materialised views on my FlightRPC Data Ingestion Server (https://www.boilstream.com). While, CREATE TABLE works already and can be used to create topics, CREATE VIEW would be used to create derived topics, i.e. materialised views.
Example