I\'m trying to use an SQLAlchemy expression with dask\'s read_sql_table in order to bring down a dataset that is created by joining and filtering a few different tables. The do
As Chris said in a different answer, Dask wraps your query in something of a form SELECT columns FROM (yourquery)
, which is an invalid syntax for PostgreSQL, because it expects an alias for that parenthesised expression. Without reimplementing the whole read_sql_table
method, the expression can be aliased simply by adding .alias('somename')
to your select, i.e.
select([t]).limit(5).alias('foo')
That expression, when wrapped by Dask, generates correct syntax for Postgres
SELECT columns FROM (yourquery) AS foo