Re: [sqlalchemy] Non-repeatable reads, vectorized refresh

2022-08-29 Thread Evgenii
quot;The unique() method must be invoked on this Result, " sqlalchemy.exc.InvalidRequestError: The unique() method must be invoked on this Result, as it contains results that include joined eager loads against collections ​ среда, 24 августа 2022 г. в 16:53:26 UTC+3, Mike Bayer: > > > On Wed,

Re: [sqlalchemy] Non-repeatable reads, vectorized refresh

2022-08-24 Thread Evgenii
23 августа 2022 г. в 22:34:23 UTC+3, Mike Bayer: > > > On Tue, Aug 23, 2022, at 3:00 PM, Evgenii wrote: > > Thanks a lot! > I used “vectorized” for sqlalchemy.orm.Session.refresh method and mean > that it would be nice to use: > > session.refresh(instances_list) >

Re: [sqlalchemy] Non-repeatable reads, vectorized refresh

2022-08-23 Thread Evgenii
21:04:05 UTC+3, Mike Bayer: > > > On Tue, Aug 23, 2022, at 1:50 PM, Evgenii wrote: > > Hi there! > > > Please help me to understand: > I want to make two equal queries, that sends real queries to database each > time: > > > session.query(Instrument

[sqlalchemy] Non-repeatable reads, vectorized refresh

2022-08-23 Thread Evgenii
Hi there! Please help me to understand: I want to make two equal queries, that sends real queries to database each time: session.query(InstrumentTable).get(instr_id) session.query(InstrumentTable).get(instr_id) The problem is that second query returns instance from identity_map. I know how

Re: [sqlalchemy] sqlalchemy serialization bug (TypeError: list indices must be integers or slices, not str)

2022-06-24 Thread Evgenii
Yes, it works пятница, 24 июня 2022 г. в 17:58:46 UTC+3, Evgenii: > Sure, I can > > пятница, 24 июня 2022 г. в 17:06:39 UTC+3, Mike Bayer: > >> if you can test this patch and confirm it reads your old pickle format, I >> can merge it and release 1.4.39 >> >

Re: [sqlalchemy] sqlalchemy serialization bug (TypeError: list indices must be integers or slices, not str)

2022-06-24 Thread Evgenii
t > https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-f8b03063d70397a8f275287ed2c8f2e6 > > . this seemed to be enough of an edge case that I didn't attempt to > reconcile the old broken format. > > On Fri, Jun 24, 2022, at 9:16 AM, Evgenii wrote: > &g

[sqlalchemy] sqlalchemy serialization bug (TypeError: list indices must be integers or slices, not str)

2022-06-24 Thread Evgenii
Hello! We found bug in SA version `1.4.38` during deserialization. How to reproduce: Serialize any ORM object with pickle using environment with any SA compatible version `1.4.n` except `1.4.38` in , ex. `1.4.31`: ``` pickle.dumps(obj) ``` Deserialize result using environment with SA version

[sqlalchemy] AttributeError("module 'sqlalchemy' has no attribute 'dialects'"

2022-04-07 Thread Evgenii
Hello! Thank you for the previous answer. I use prefect and dask to execute workflows, that use SA inside and I get very strange errors periodically: Task 'HE Quotes[5]': Exception encountered during task execution! Traceback (most recent call last): File

Re: [sqlalchemy] SQLAlchemy + multiprocessing problems

2022-03-31 Thread Evgenii
at > https://docs.sqlalchemy.org/en/14/core/pooling.html#using-connection-pools-with-multiprocessing-or-os-fork > > .It was recently pointed out that this closes out the parent process' > connections, so in SQLAlchemy 1.4.33 there will be a parameter so you can > change t

[sqlalchemy] SQLAlchemy + multiprocessing problems

2022-03-31 Thread Evgenii
Hello! >From time to time, I need to update data in tables and multiprocessing can speed up this process. Last example: I’m trying to update data 7M rows in table SQLAlchemy 1.4.31, psycopg2 2.8.6, PostgreSQL def job_update_rd(data_list): updated = [] with Session() as session:

Re: [sqlalchemy] sqlalchemy.exc.InvalidRequestError: Can't attach instance another instance with key is already present in this session

2021-07-20 Thread Evgenii
gt; https://docs.sqlalchemy.org/en/14/orm/session_api.html?highlight=session%20merge#sqlalchemy.orm.Session.merge > > however the main issue is that you are mixing results from multiple > sessions, which in the vast majority of cases is unnecessary. The session > corresponds to working

Re: [sqlalchemy] sqlalchemy.exc.InvalidRequestError: Can't attach instance another instance with key is already present in this session

2021-07-20 Thread Evgenii
d > normally be able to complete all the work you have for a particular > operation within that single scope. > > On Mon, Jul 19, 2021, at 8:31 AM, Evgenii wrote: > > > Hello! > I’m using many-to-many relation, and this relationship bar_list must have > list of >

[sqlalchemy] sqlalchemy.exc.InvalidRequestError: Can't attach instance another instance with key is already present in this session

2021-07-19 Thread Evgenii
Hello! I’m using many-to-many relation, and this relationship bar_list must have list of instances. Some of them can be repeated (ex. [inst1, inst2, inst1]). I attach very simplified code there (all of database interaction is hidden under the hood, user accesses database at top level, but this