Re: [sqlalchemy] Error: Packet sequence number wrong for read replica

2023-06-22 Thread Federico Caselli
Hi, > It seems SQLAlchemy uses the same session for all request because session is created with same way we did in SQLAlchemy instance no it creates a single *scoped* session, but that uses a thread local variable to have a different session for each thread. Also I think flask sqlalchemy will

[sqlalchemy] Re: Trying to find a way to sort a query given the name of one of its columns

2023-06-11 Thread Federico Caselli
Also you may not need the col_by_name at all for order_by, since you can pass the string in order_by directly: https://docs.sqlalchemy.org/en/20/tutorial/data_select.html#tutorial-order-by-label This case is still not supported, since doing "query.order_by('firstname')" raises "column not found"

[sqlalchemy] Re: Reflections on the SA 2.0 new PG Range

2022-12-01 Thread Federico Caselli
Postgresql does use isempty for the function that test if a range is empty https://www.postgresql.org/docs/current/functions-range.html#RANGE-OPERATORS-TABLE On Thursday, 1 December 2022 at 22:50:11 UTC+1 leleg...@gmail.com wrote: > "Mike Bayer" writes: > > > On Thu, Dec 1, 2022, at 1:01 PM, Le

Re: [sqlalchemy] Why was the column information stripped away in SA 1.4.20 that existed in 1.3.20?

2021-09-01 Thread Federico Caselli
Hi, This is a pandas bug, not an sqlalchemy ones. It was already reported here https://github.com/pandas-dev/pandas/issues/40682 On Tuesday, 31 August 2021 at 23:15:04 UTC+2 Gord Thompson wrote: > *With version 1.3:* > > Base = declarative_base() > > > class User(Base): > __tablename__ = "user"

[sqlalchemy] Re: Testing and deprecation of nested transactions

2021-07-30 Thread Federico Caselli
Hi, Have you tried using this pattern from the documentation? I think you can also use that while using only connections https://docs.sqlalchemy.org/en/14/orm/session_transaction.html?highlight=after_transaction_end#joining-a-session-into-an-external-transaction-such-as-for-test-suites On Saturd

[sqlalchemy] Re: joinedload().load_only() emits 2.0 warning

2021-07-20 Thread Federico Caselli
Updated here https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/2959 On Friday, 16 July 2021 at 14:00:33 UTC+2 leleg...@gmail.com wrote: > Federico Caselli writes: > > > There is no difference, it's the documentation that's outdated. > > > > We should up

[sqlalchemy] Re: joinedload().load_only() emits 2.0 warning

2021-07-16 Thread Federico Caselli
There is no difference, it's the documentation that's outdated. We should update that On Friday, 16 July 2021 at 09:22:52 UTC+2 leleg...@gmail.com wrote: > Federico Caselli writes: > > > As the warning mebtions, the issue is that you are using the string name > > w

Re: [sqlalchemy] joinedload().load_only() emits 2.0 warning

2021-07-15 Thread Federico Caselli
Hi. As the warning mebtions, the issue is that you are using the string name with load only instead of the column from the class. In this load only from the file: .load_only('firstname'))) On Thursday, 15 July 2021 at 14:28:29 UTC+2 Mike Bayer wrote: > i can look later, if i forget after a day

Re: [sqlalchemy] SQLAlchemy 1.4 / 2.0 distribution

2021-06-10 Thread Federico Caselli
Hi, > The problem is that currently only the entire codebase can be migrated from 1.3 to 1.4, even though it can be extremely difficult or too long to do. I don't agree with this assessment. From my experience the main incompatibility is the url that has become immutable. Other than this most

Re: [sqlalchemy] Delay in accessing table with 2 enum columns using asyncpg + ORM

2021-03-26 Thread Federico Caselli
. Feel free to use the snipped I created. On Thursday, 25 March 2021 at 22:41:24 UTC+1 Mike Bayer wrote: > you would need to use: > > 1. a transaction > > 2. prepared = prepare(sql) > > 3. await prepared.execute() > > 4. the prepare() and execute() need to be inside of an a

Re: [sqlalchemy] Delay in accessing table with 2 enum columns using asyncpg + ORM

2021-03-25 Thread Federico Caselli
13,693 DEBUG sqlalchemy.engine.Engine Row (1,) >> 2021-03-25 20:22:13,694 INFO sqlalchemy.engine.Engine COMMIT >> 2021-03-25 20:22:13,700 INFO sqlalchemy.engine.Engine BEGIN (implicit) >> 2021-03-25 20:22:13,701 INFO sqlalchemy.engine.Engine INSERT INTO >> "TableB" (b

Re: [sqlalchemy] Delay in accessing table with 2 enum columns using asyncpg + ORM

2021-03-25 Thread Federico Caselli
?) RETURNING "TableB".id 2021-03-25 20:22:13,701 INFO sqlalchemy.engine.Engine [cached since 1.063s ago] ('FOUR', 'SIX') 2021-03-25 20:22:13,705 DEBUG sqlalchemy.engine.Engine Col ('id',) 2021-03-25 20:22:13,706 DEBUG sqlalchemy.engine.Engine Row (2,) 2021-0

Re: [sqlalchemy] Delay in accessing table with 2 enum columns using asyncpg + ORM

2021-03-25 Thread Federico Caselli
Hi, I've tried the script and I also cannot reproduce it: py3.7 + pg 13.1 (non-docker) on windows 2021-03-25 19:35:15,977 INFO sqlalchemy.engine.Engine BEGIN (implicit) 2021-03-25 19:35:15,979 INFO sqlalchemy.engine.Engine INSERT INTO "TableA" (a) VALUES (?) RETURNING "TableA".id 2021-03-25 19: