Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

session.merge sqlalchemy

stmt = (
    select(User).
    where(User.name.in_(names)).
    execution_options(populate_existing=True).
    options(selectinload(User.addresses)
)
# will refresh all matching User objects as well as the related
# Address objects
users = session.execute(stmt).scalars().all()
Source by docs.sqlalchemy.org #
 
PREVIOUS NEXT
Tagged: #sqlalchemy
ADD COMMENT
Topic
Name
5+7 =