I have three different types of post tables with all of the same columns except that the first table has an extra column named "type" (placed in-between the 'user_id' and 'title' columns of the other tables). I want to do a UNION ALL that will combine the data from all these tables into a single list (with a blank value for the tables missing the "type" column), and then I want to sort the posts by creation date.
However, try as I might, I cannot seem to get this to work without throwing me an ArgumentError of "All selectables passed to CompoundSelect must have identical numbers of columns; select #1 has 7 columns, select #2 has 6". I suspect this has something to do with SQLAlchemy auto-magically reading the DeclarativeBase table classes. The SQL version of this query would look something like: SELECT 'cat1' as category, * FROM posts_1 UNION ALL SELECT 'cat2', id, user_id, 'NONE', title, body, created, updated FROM posts_2 UNION ALL SELECT 'cat3', id, user_id, 'NONE', title, body, created, updated FROM posts3 ORDER BY created DESC LIMIT 10 How can I get this to translate into SQLAlchemy with the extra 'NONE' for the tables that don't have a "type" column without giving me the ArgumentError? Thanks, Seth --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---
