Holy buckets I found it.
I *had* this:
display_name = Column(
'display_name', String(length=255), nullable=False, primaryKey=True)
That little primaryKey bit right there, not supposed to be there.
On Fri, Aug 2, 2019 at 2:16 PM Michael P. McDonnell <[email protected]>
wrote:
> Oh! I should add - when do a len() on the results of query.all() - I Get
> *1* until I change the display_name
>
> On Fri, Aug 2, 2019 at 2:10 PM Michael P. McDonnell <[email protected]>
> wrote:
>
>> So when I generate the query with SQL Alchemy (using the ORM) I get the
>> following:
>>
>> SELECT game_leaderboard.game_id, game_leaderboard.person_id,
>> game_leaderboard.display_name, game_leaderboard.total_tasks,
>> game_leaderboard.tasks_completed, game_leaderboard.duration
>> FROM game_leaderboard
>> WHERE game_leaderboard.game_id = %(game_id_1)s
>> Data: game_id='5184b7eb-b687-4471-8aa9-7b6715b7a9aa'
>>
>> I get the following result:
>> [
>> {
>> "total_tasks": 2,
>> "display_name": "Auto Test ",
>> "tasks_completed": 2,
>> "person_id": "96736b38-b854-403c-90d8-0701c23efe55",
>> "duration": "0:08:00",
>> "game_id": "5184b7eb-b687-4471-8aa9-7b6715b7a9aa"
>> }
>> ]
>>
>> However when I run this same query (generated) in psql:
>> odyssey=# SELECT game_leaderboard.game_id, game_leaderboard.person_id,
>> game_leaderboard.display_name, game_leaderboard.total_tasks,
>> game_leaderboard.tasks_completed, game_leaderboard.duration
>> FROM game_leaderboard
>> WHERE game_leaderboard.game_id = '5184b7eb-b687-4471-8aa9-7b6715b7a9aa';
>> game_id | person_id
>> | display_name | total_tasks | tasks_completed | duration
>>
>> --------------------------------------+--------------------------------------+--------------+-------------+-----------------+----------
>> 5184b7eb-b687-4471-8aa9-7b6715b7a9aa |
>> 96736b38-b854-403c-90d8-0701c23efe55 | Auto Test | 2 |
>> 2 | 00:08:00
>> 5184b7eb-b687-4471-8aa9-7b6715b7a9aa |
>> ac370ba6-0ea8-4068-8cac-0337b6807481 | Auto Test | 2 |
>> 2 | 00:16:00
>>
>> I have determined however - if I change the "display_name" to something
>> different between the two people, I suddenly get 2 results from query.all()
>>
>> This is doing a query on a VIEW.
>>
>> Any ideas on where I can start looking at this?
>>
>>
--
SQLAlchemy -
The Python SQL Toolkit and Object Relational Mapper
http://www.sqlalchemy.org/
To post example code, please provide an MCVE: Minimal, Complete, and Verifiable
Example. See http://stackoverflow.com/help/mcve for a full description.
---
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sqlalchemy/CAHmCLHpmHN2NUtCnoJ65tq5DipH1hp_LgyWtDynZnztS2StHsQ%40mail.gmail.com.