Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 1,022 for mode (0.17 sec)

  1. tests/test_read_with_orm_mode.py

            class Config:
                orm_mode = True
                read_with_orm_mode = True
    
        class PersonCreate(PersonBase):
            pass
    
        class PersonRead(PersonBase):
            full_name: str
    
            class Config:
                orm_mode = True
    
        app = FastAPI()
    
        @app.post("/people/", response_model=PersonRead)
        def create_person(person: PersonCreate) -> Any:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 2.4K bytes
    - Viewed (0)
  2. docs_src/sql_databases/sql_app/schemas.py

    class Item(ItemBase):
        id: int
        owner_id: int
    
        class Config:
            orm_mode = True
    
    
    class UserBase(BaseModel):
        email: str
    
    
    class UserCreate(UserBase):
        password: str
    
    
    class User(UserBase):
        id: int
        is_active: bool
        items: List[Item] = []
    
        class Config:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 502 bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/sql-databases.md

    * It requires more code and is a bit more complex.
    * The middleware has to be an `async` function.
        * If there is code in it that has to "wait" for the network, it could "block" your application there and degrade performance a bit.
        * Although it's probably not very problematic here with the way `SQLAlchemy` works.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  4. docs_src/background_tasks/tutorial002_py310.py

    from fastapi import BackgroundTasks, Depends, FastAPI
    
    app = FastAPI()
    
    
    def write_log(message: str):
        with open("log.txt", mode="a") as log:
            log.write(message)
    
    
    def get_query(background_tasks: BackgroundTasks, q: str | None = None):
        if q:
            message = f"found query: {q}\n"
            background_tasks.add_task(write_log, message)
        return q
    
    
    @app.post("/send-notification/{email}")
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 643 bytes
    - Viewed (0)
  5. docs/zh/docs/advanced/events.md

    使用 `shutdown` 事件声明 `app` 关闭时运行的函数:
    
    ```Python hl_lines="6"
    {!../../../docs_src/events/tutorial002.py!}
    ```
    
    此处,`shutdown` 事件处理器函数在 `log.txt` 中写入一行文本 `Application shutdown`。
    
    !!! info "说明"
    
        `open()` 函数中,`mode="a"` 指的是**追加**。因此这行文本会添加在文件已有内容之后,不会覆盖之前的内容。
    
    !!! tip "提示"
    
        注意,本例使用 Python `open()` 标准函数与文件交互。
    
        这个函数执行 I/O(输入/输出)操作,需要等待内容写进磁盘。
    
        但 `open()` 函数不支持使用 `async` 与 `await`。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 1.7K bytes
    - Viewed (0)
  6. docs/ko/docs/advanced/events.md

    ```Python hl_lines="6"
    {!../../../docs_src/events/tutorial002.py!}
    ```
    
    이 예제에서 `shutdown` 이벤트 핸들러 함수는 `"Application shutdown"`이라는 텍스트가 적힌 `log.txt` 파일을 추가할 것입니다.
    
    !!! info "정보"
        `open()` 함수에서 `mode="a"`는 "추가"를 의미합니다. 따라서 이미 존재하는 파일의 내용을 덮어쓰지 않고 새로운 줄을 추가합니다.
    
    !!! tip "팁"
        이 예제에서는 파일과 상호작용 하기 위해 파이썬 표준 함수인 `open()`을 사용하고 있습니다.
    
        따라서 디스크에 데이터를 쓰기 위해 "대기"가 필요한 I/O (입력/출력) 작업을 수행합니다.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Apr 02 22:35:55 GMT 2024
    - 2.2K bytes
    - Viewed (0)
  7. fastapi/_compat.py

        def _model_rebuild(model: Type[BaseModel]) -> None:
            model.model_rebuild()
    
        def _model_dump(
            model: BaseModel, mode: Literal["json", "python"] = "json", **kwargs: Any
        ) -> Any:
            return model.model_dump(mode=mode, **kwargs)
    
        def _get_model_config(model: BaseModel) -> Any:
            return model.model_config
    
        def get_schema_from_model_field(
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 22.6K bytes
    - Viewed (0)
  8. docs/en/docs/advanced/events.md

    You can define logic (code) that should be executed before the application **starts up**. This means that this code will be executed **once**, **before** the application **starts receiving requests**.
    
    The same way, you can define logic (code) that should be executed when the application is **shutting down**. In this case, this code will be executed **once**, **after** having handled possibly **many requests**.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  9. docs_src/sql_databases/sql_app_py39/schemas.py

    class Item(ItemBase):
        id: int
        owner_id: int
    
        class Config:
            orm_mode = True
    
    
    class UserBase(BaseModel):
        email: str
    
    
    class UserCreate(UserBase):
        password: str
    
    
    class User(UserBase):
        id: int
        is_active: bool
        items: list[Item] = []
    
        class Config:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 496 bytes
    - Viewed (0)
  10. docs_src/sql_databases_peewee/sql_app/schemas.py

        id: int
        owner_id: int
    
        class Config:
            orm_mode = True
            getter_dict = PeeweeGetterDict
    
    
    class UserBase(BaseModel):
        email: str
    
    
    class UserCreate(UserBase):
        password: str
    
    
    class User(UserBase):
        id: int
        is_active: bool
        items: List[Item] = []
    
        class Config:
            orm_mode = True
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 868 bytes
    - Viewed (0)
Back to top