On Tue, Nov 6, 2018 at 10:33 PM Paul Becotte <pjbeco...@gmail.com> wrote:
>
> Hi!
>
> I recently needed to use the select ... into ... construct to build a temp 
> table in Redshift. I used the recipe 
> https://bitbucket.org/zzzeek/sqlalchemy/wiki/UsageRecipes/SelectInto here to 
> get a good idea of how to go about this, and was wondering if I should 
> contribute the final working version back to the project. The biggest thing 
> that gives me pause is that the recipe says that this would be added in 2014, 
> and it hasn't been, so I feel like you probably have a good reason that I am 
> ignorant about! The other, less of a blocker, is that I am not actually sure 
> of a comprehensive list of database engines that support don't support this- 
> I know Postgres, Snowflake, Redshift, and MSSQL do... but I am out of 
> expertise at that point. For something like this that may or may not be 
> supported in all database engines, are there good examples of how that should 
> be handled in the existing code base?

We have INSERT FROM SELECT, which is kind of where that went.  The
difference between these two constructs is that one of them creates
the table automatically as well.   But SQLAlchemy can already automate
the creation of the table since it can generate CREATE TABLE
statements as easily as it generates the INSERT, so the urgency of
SELECT INTO has never been realized.    This SO answer tries to get at
what might be nicer about SELECT INTO:
https://stackoverflow.com/a/6948075 .    As far as adding it, it's
probably syntactially a lot simpler than INSERT FROM SELECT to render,
but from a SQLAlchemy perspective, it's awkward, because we've just
run SELECT INTO.  Now we want to get a Table back for that.  So...we
have to figure that out from the select() that we gave it and create a
copy, also is this Table associated with a MetaData()?  stuff like
that.     As far as where it goes, if it's in the SQL standard it can
be part of the non-dialect-specific SQL code which I think is the case
here though we should check.


>
> --
> SQLAlchemy -
> The Python SQL Toolkit and Object Relational Mapper
>
> http://www.sqlalchemy.org/
>
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> ---
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at https://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to