-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix/depricated refrence in sql databases #13253
base: master
Are you sure you want to change the base?
Fix/depricated refrence in sql databases #13253
Conversation
📝 Docs preview for commit 6840483 at: https://af29a5e2.fastapitiangolo.pages.dev Modified Pages |
📝 Docs preview for commit d74bee7 at: https://2fd15ee3.fastapitiangolo.pages.dev Modified Pages |
|
||
### Create Database Tables on Startup | ||
|
||
We will create the database tables when the application starts. | ||
|
||
{* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[32:37] hl[35:37] *} | ||
{* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[33:40] hl[33:36, 40] *} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to include into this part of the code the line:
app = FastAPI(lifespan=lifespan)
So that the full lifespan integration process is shown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure it was included. as you can see i highlighted a blank line.... I think it must be due to the pre-commit format or my fork not being synced with master.
I'll check it.
I support the changes proposed by @IdleSys. 👍 The corrections I suggested are optional, and it is up to the PR author to implement them or not. 😊 |
📝 Docs preview for commit 3afe545 at: https://95e4f9b5.fastapitiangolo.pages.dev Modified Pages |
3afe545
to
2f95f2b
Compare
📝 Docs preview for commit 2f95f2b at: https://427ce36a.fastapitiangolo.pages.dev Modified Pages |
There is one more thing to think about: when the reference code is modified all the translations related to it will get corrupted. |
Thank you for your input, @alv2017 Currently, I am facing an issue where my local preview does not match the preview of the link that robot provided. Regarding the problem you mentioned, it arises from my changes to the document sources. I see two possible solutions:
|
all the groups are quite active, and probably it won't be difficult to get support from them
I think that we will need help from the maintainers to move forwards with that. |
@alv2017 Good News |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not rush. 😄 :
I approve your proposal regarding documentation update, but the pull request doesn't look good to me, it just got too complicated. I doubt that it can be approved.
It is time to ask for guidance and advice. 😊
|
||
### Create Database Tables on Startup | ||
|
||
We will create the database tables when the application starts. | ||
|
||
{* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[32:37] hl[35:37] *} | ||
{* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[33:40] hl[33:36, 40] *} | ||
|
||
Here we create the tables on an application startup event. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this place I suggest to explain that with the help of the lifespan we create the tables before the application starts accepting requests, and provide the link to the Lifespan tutorial.
So that we get rid of warning, that introduce extra complication to the content.
|
||
/// warning | ||
|
||
The `@app.on_event("startup")` and `@app.on_event("shutdown")` decorators are **deprecated** as of FastAPI v0.103.0. | ||
|
||
Use the <a href="https://fastapi.tiangolo.com/advanced/events/#lifespan" class="external-link" target="_blank">`lifespan`</a> parameter in the `FastAPI` class instead for lifecycle management. | ||
|
||
/// | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to get rid of the warning, and explain the usage of the lifespan in the sentence that I commented above.
Hi @tiangolo, @alejsdev, sorry for bothering you, but we need your help and guidance. We would like to make some updates to the code related to the SQL (Relational) Databases tutorial, and guide users towards using the new lifespan event handling system for managing application startup and shutdown events. However when working on the PR we noticed, that it gets overly complex. The required changes are as follows:
Questions:
Thank you! 😊 |
Overview
This pull request updates the FastAPI documentation to reflect the deprecation of the
@app.on_event
decorator in the SQL database section of tutorial. The documentation has been revised to guide users towards using the new lifespan event handling system for managing application startup and shutdown events.Changes Made
Updated Documentation:
doc_src
files.Testing