hi,
for the background, pls refer to this link.
https://bitbucket.org/zzzeek/sqlalchemy/issue/3384/how-to-generate-complicated-nested-sql
I just follow Mike's suggestion, that is, only send sql templates and
json/hstore/string/datetime objects to database instead of raw SQL
statements. (if i
Michael, thank you for you reply, I expected you to mention from_self :) I
know about it, it is a handy trick indeed
But I deliberately don't use it, because this way I don't know how to
mention a column which I want to filter on
This is due to the fact, that it is calculated i.e. there is no
Ok, I seemed to figure out how to deal with it -
row_number_column = func.row_number().over(
partition_by=Recipe.id
).label('row_number')
query = query.add_column(
row_number_column
)
query = query.from_self().filter(row_number_column == 1)
Using an explicit column construct
суббота, 25
2015-04-24 18:06 GMT+02:00 Jonathan Vanasco jonat...@findmeon.com:
SqlAlchemy needs 2 things for a database work:
1. A python database driver
2. A SqlAlchemy dialect (that tells SqlAlchemy how to write sql for the
driver)
So...
1. H2 doesn't seem to have any Python drivers or other
Still getting the same error with 1.0.2.
It's using a custom base class passed to declarative.declarative_base().
The class is pretty simple -- mostly just a declared_attr to set the
__tablename__ and a custom __repr__.
I'll see if I can pare it down to a simple test case.
--
Bill
--
You
On 4/25/15 6:05 AM, Юрий Пайков wrote:
Ok, I seemed to figure out how to deal with it -
|
row_number_column = func.row_number().over(
partition_by=Recipe.id
).label('row_number')
query = query.add_column(
row_number_column
)
query = query.from_self().filter(row_number_column == 1)
|
This may have been an instance of working by accident. In setting up
declarative_base, we're passing in a mapper function. Our mapper function
wasn't returning the result of the SA mapper(). It didn't cause any
(explicit) errors through 0.9.8, but I have a feeling that was just luck.
On