This issue is no longer occurring, so I take back the question for now :)
On Monday, December 7, 2020 at 12:31:09 AM UTC+8 RexE wrote:
> Hello, thank you for the reply. All those lists are the output of:
>
> session.query(Player).all()
>
> For example, here is my code:
>
> player_list =
Hello, thank you for the reply. All those lists are the output of:
session.query(Player).all()
For example, here is my code:
player_list = db.query(Player).all()
ids_only = [p.id for p in player_list]
print('player_list', player_list)
print('ids_only', ids_only)
Here is the output:
hey there -
it seems pretty likely that the source of objects you are using, which would be
the "query" you refer towards, or some process afterwards by which these
objects are assembled into the list you are printing, contains the same object
instance multiple times, hence you see the same
Hello, I have this base model:
class AnyModel(DeclarativeBase):
__abstract__ = True
id = Column(st.Integer, primary_key=True)
def __repr__(self):
return '<{} id={}>'.format(self.__class__.__name__, self.id)
repr() seems to be printing the incorrect value for my IDs. For