On Tue, Jul 21, 2009 at 11:54, cleg<[email protected]> wrote:
>
> Hello
>
> I'm using an autoloaded table, mapped to a view in Postgre DB.
>
> class MyStats(Entity):
>    """Mapping for view"""
>    using_options(tablename = 'stats_view', autoload = True)
>    using_mapper_options(primary_key=['date', 'owner'])
>
> When I'm trying to query some rows with "start" and "offset"
> statements, I'm running into a strange issue.
> I'm doing the following thing:
>
>    metadata.bind.echo = True
>    query = MyStats.query()
>    qry_res = query[0:50]
>
> In the log displayed correct query with " LIMIT 50 OFFSET 0" statement
> in the end. When I'm executing query from log in the pgAdmin - all OK,
> I'm having 50 rows fetched.
> But in Python qry_res contains 13 rows only.

Could it be that in those 50 rows, only 13 have unique values for the
primary keys? I *think* SQLAlchemy can't load several instances with
the same primary key.

> Is there any possibility to receive more debug information (e.g.
> physically fetched rows).

Not sure. I once needed that and added some debugging stuff in
sqlalchemy/engine/base.py:fetchall
There is probably a cleaner way though but I didn't bother to find it.

-- 
Gaëtan de Menten
http://openhex.org

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to