litestar-org / polyfactory

Simple and powerful factories for mock data generation
https://polyfactory.litestar.dev/
MIT License
988 stars 78 forks source link

feat(sqla_factory): refresh object in async_session after commit to db #541

Closed wangxin688 closed 3 months ago

wangxin688 commented 3 months ago

Description

Use Case: column use server_default to generate default value in database side. If we use asyncsession, and access this attribute from orm object, it will raise sqlalchemy.exc.MissingGreenlet error. There are two ways to solve this issue.

guacs commented 3 months ago

cc: @adhtruong

wangxin688 commented 3 months ago

I think this PR is ready for review now

github-actions[bot] commented 3 months ago

Documentation preview will be available shortly at https://litestar-org.github.io/polyfactory-docs-preview/541

adhtruong commented 3 months ago

@all-contributors add @wangxin688 for code

allcontributors[bot] commented 3 months ago

@adhtruong

I've put up a pull request to add @wangxin688! :tada: