Closed
Description
Describe the use case
I think it's related with #6991 , when I use the scalars method with the async scoped session it gives me an attribute error.
I see the implementations in the AsyncEngine and AsyncSession, but it looks that there is no implementation for the async_scoped_session
AttributeError: 'async_scoped_session' object has no attribute 'scalars'
Databases / Backends / Drivers targeted
PostgreSQL with asyncpg driver
Example Use
...
engine = create_async_engine(db_connstring)
session = async_scoped_session(
sessionmaker(bind=engine, expire_on_commit=False, class_=AsyncSession),
scopefunc=current_task)
rows = await session.scalars(select(TableOne))
...
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
CaselIT commentedon Sep 28, 2021
Hi,
Thanks for reporting. I guess the same is true for scoped_session.
@zzzeek do you think we could automate testing for this, so that we catch similar issues in the future?
zzzeek commentedon Sep 28, 2021
im not really sure because the scoped objects don't track every attribute
CaselIT commentedon Sep 28, 2021
maybe we could have a test with a ignore_list when check that all other attributes are mapped. so what if something is added there is a conscious choice if it should also be in the scoped object or not
zzzeek commentedon Sep 28, 2021
OK, we can flip our existing tests to use ignore list instead if you want to try that.
sqla-tester commentedon Sep 28, 2021
Federico Caselli has proposed a fix for this issue in the master branch:
Add missing methods added in 🎫
6991
https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/3112sqla-tester commentedon Feb 27, 2023
Grey Li referenced this issue:
Add separate version notes for scalars https://gerrit.sqlalchemy.org/c/sqlalchemy/sqlalchemy/+/4470
3 remaining items