Re: [sqlalchemy] column_property query for a table that has not been defined yet

2018-04-02 Thread Mike Bayer
you need a column-based expression there so you should use literal_column: http://docs.sqlalchemy.org/en/latest/core/sqlelement.html?highlight=literal_column#sqlalchemy.sql.expression.literal_column but also that expression won't be usable in every case because you are correlating it to the name

[sqlalchemy] column_property query for a table that has not been defined yet

2018-04-02 Thread Colton Allen
I'm trying to write a column_property that queries a table that will be defined after the current table is defined. I tried using raw SQL but I'm getting an error. On the "page" table I define a "count_posts" column_property. count_posts = orm.column_property(text( 'SELECT count(post.id)