Skip to content

Conversation

@hadrien
Copy link
Owner

@hadrien hadrien commented Oct 2, 2025

Problem

Solution

  • add new_lifespan to allow passing sqla engine parameters directly:
    from fastapi import FastAPI
    from fastsqla import new_lifespan
    
    lifespan = new_lifespan(
        "sqlite+aiosqlite:///app/db.sqlite"), connect_args={"autocommit": False}
    )
    
    app = FastAPI(lifespan=lifespan)

@codecov
Copy link

codecov bot commented Oct 3, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (3be5771) to head (794d8bc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main       #25   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          100       108    +8     
  Branches         6         7    +1     
=========================================
+ Hits           100       108    +8     
Flag Coverage Δ
default 100.00% <100.00%> (ø)
sqlmodel 98.14% <100.00%> (+0.14%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hadrien
Copy link
Owner Author

hadrien commented Oct 3, 2025

@vicrep What do you think? thanks!

@hadrien hadrien merged commit 584686c into main Oct 3, 2025
5 checks passed
@hadrien hadrien deleted the feat/configuration branch October 3, 2025 19:20
@vicrep
Copy link

vicrep commented Oct 3, 2025

This is great, thanks for doing this @hadrien !

I liked the 12-factor-style-config being the default recommended approach, but for some specific setups, and nested config args (eg. that reported issue), the ergonomics of doing it fully through environ were at times lacking.

@hyperknot
Copy link

Super nice, thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enabling Non-Legacy SQLite Transactional Modes

4 participants