sea-orm icon indicating copy to clipboard operation
sea-orm copied to clipboard

feat: Support for lazy database connections

Open spencewenski opened this issue 1 year ago • 2 comments

PR Info

  • Relates to https://github.com/SeaQL/sea-orm/discussions/1645
  • Dependencies: N/A
  • Dependents: N/A

New Features

Add support for creating DB connection pools without establishing connections up front. This is already supported by SQLx via the Pool::connect_lazy method.

This was discussed previously here, but it appears support was never added to SEA ORM directly.

Bug Fixes

  • [x] N/A

Breaking Changes

  • [x] N/A

Changes

This PR adds a new connect_lazy option to database::ConnectOptions. If set to true, the SQLx Pool will be created using the Pool::connect_lazy_with method; otherwise, the Pool::connect_with method will be used (e.g., the existing behavior). This "lazy" behavior is implemented for each DB variant (Postgres/MySQL/SQLite).

spencewenski avatar Jun 22 '24 23:06 spencewenski

Hey @billy1624 , @tyt2y3 , can you take a look at this when you get a chance? Or assign to someone else to review? Thanks!

spencewenski avatar Jun 27 '24 00:06 spencewenski

Hey @billy1624 and @tyt2y3 sorry to ping you again. Can you take a look when you get a chance? Thanks!

spencewenski avatar Jun 30 '24 08:06 spencewenski

Great, thanks for the approval, @billy1624! And no worries! I understand you’re probably busy.

spencewenski avatar Jul 04 '24 06:07 spencewenski

Hey @tyt2y3, any chance you can take a look at this soon? Or let me know approximately when you’ll be able to take a look?

spencewenski avatar Jul 11 '24 00:07 spencewenski

Hey @billy1624 and @tyt2y3, just wondering when we can get this merged since it’s been approved for a while now. Thanks!

spencewenski avatar Jul 20 '24 20:07 spencewenski

Thank you

tyt2y3 avatar Aug 20 '24 10:08 tyt2y3

:tada: Released In 1.0.1 :tada:

Thank you everyone for the contribution! This feature is now available in the latest release. Now is a good time to upgrade! Your participation is what makes us unique; your adoption is what drives us forward. You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

github-actions[bot] avatar Aug 27 '24 08:08 github-actions[bot]