CREATE TABLE AS SELECT using SQLAlchemy?

Viewed 398

I'm trying to use SQLAlchemy to create a table from a SELECT clause as in the following query:

CREATE TABLE new_table AS 
  SELECT foo, bar, baz
  FROM other_table
  WHERE foo > 50

I know that I can run a CREATE TABLE, then SELECT and finally INSERT, but this will ultimately be working with large quantities of data so bringing it into memory is not desirable. Equally I don't want to construct a text query and execute that.

0 Answers
Related