alamb opened a new issue #1213:
URL: https://github.com/apache/arrow-datafusion/issues/1213


   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   `CREATE TABLE AS SELECT` allows one to create new tables using the result of 
a sql query
   
   This would allow for usecases like:
   1. Easier creation of tables for test cases / bug reproducers (now I have 
echo data to csv files, or use `VALUES` caluse)
   2. Start preparing the way for using datafusion-cli for more ETL like 
operations (like reading data, transforming it, and writing it out)
   
   **Describe the solution you'd like**
   
   Implement `CREATE TABLE AS SELECT` like postgres: 
https://www.postgresql.org/docs/8.1/sql-createtableas.html
   
   So like
   ```sql
   // create a new table
   create table foo as select * from values(1,'a'), (2, 'b')
   
   // Should return
   // 1 a
   // 2 b
   select * from foo
   ```
   
   I do not think this feature belongs in the core datafusion module (or maybe 
in the core module, but could be enabled/disabled) as various database engines 
will want / not want the ability to create a table in memory depending on how 
they are being used
   
   I think we have all the pieces:
   - [ ] Support in sqlparser
   - [ ] MemTable support
   
   This would just need to code to handle it
   
   There is a similar pattern for `CreateExternalTable` that we could probably 
folllow:
   
   **Describe alternatives you've considered**
   Don't add feature
   
   **Additional context**
   Add any other context or screenshots about the feature request here.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to