

just creating the list by looping over the result set), it'd be nice to be able to alias nested queries within peewee.

While I can work around this by performing the Group_Concat outside of peewee (i.e.

"OperationalError: (1248, 'Every derived table must have its own alias')"Ī solution would be to have an alias pool for queries that make use of the 'from_' function, for nested queries.Ī test to demonstrate an error when using nested queries in peewee (MySQL): When running the same script, while using the MySQL config, you will get the following error upon visiting the root of the app. Using SQLITE, upon visiting the root of the app ( you will get a list of IDs resulting from the Group_Concat (1,2,3,4,5). Please see the below link to a gist that demonstrates this issue. You can find more about inline views, derived tables, and common table expressions in this older post of mine. If you need the two fields as entirely separate rows each with its own. This make sense when you think about query optimization engines work, but that’s a story for a much longer post. Sql Nested JsonThe primary option for executing a MySQL query from the command.
#Mysql union every derived table must have its own alias driver#
The issue is - as the error message describes - that the table that is derived after using the 'from_' function is not provided with an alias. MySQL requires that every derived table have its own alias. MySQL :: Derived Table Alias Error Forum List Microsoft Access New Topic Derived Table Alias Error Posted by: ram jag Date: Aug11:51AM Hi folks, MySQL ODBC 3.51 Driver mysqld-5.0. While playing around with the 'from_' function that was introduced recently (I believe it was pretty recent (see !topic/peewee-orm/FSHhd9lZvUE), and ran into a bit of an issue when attempting to use the same query that worked under SQLITE, on a MySQL database.
