Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for Model (0.18 sec)

  1. docs/zh/docs/tutorial/sql-databases.md

    这样,而不是仅仅试图从`dict`上 `id` 中获取值,如下所示:
    
    ```Python
    id = data["id"]
    ```
    
    尝试从属性中获取它,如:
    
    ```Python
    id = data.id
    ```
    
    有了这个,Pydantic*模型*与 ORM 兼容,您只需在*路径操作*`response_model`的参数中声明它即可。
    
    您将能够返回一个数据库模型,它将从中读取数据。
    
    #### ORM 模式的技术细节
    
    SQLAlchemy 和许多其他默认情况下是“延迟加载”。
    
    这意味着,例如,除非您尝试访问包含该数据的属性,否则它们不会从数据库中获取关系数据。
    
    例如,访问属性`items`:
    
    ```Python
    current_user.items
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 27K bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/sql-databases.md

    ```Python
    id = data.id
    ```
    
    And with this, the Pydantic *model* is compatible with ORMs, and you can just declare it in the `response_model` argument in your *path operations*.
    
    You will be able to return a database model and it will read the data from it.
    
    #### Technical Details about ORM mode
    
    SQLAlchemy and many others are by default "lazy loading".
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 29.6K bytes
    - Viewed (0)
  3. docs/em/docs/tutorial/sql-databases.md

    ```Python
    id = data["id"]
    ```
    
    ⚫️ 🔜 🔄 🤚 ⚫️ ⚪️➡️ 🔢,:
    
    ```Python
    id = data.id
    ```
    
    & ⏮️ 👉, Pydantic *🏷* 🔗 ⏮️ 🐜, & 👆 💪 📣 ⚫️ `response_model` ❌ 👆 *➡ 🛠️*.
    
    👆 🔜 💪 📨 💽 🏷 & ⚫️ 🔜 ✍ 💽 ⚪️➡️ ⚫️.
    
    #### 📡 ℹ 🔃 🐜 📳
    
    🇸🇲 & 📚 🎏 🔢 "🙃 🚚".
    
    👈 ⛓, 🖼, 👈 👫 🚫 ☕ 💽 💛 ⚪️➡️ 💽 🚥 👆 🔄 🔐 🔢 👈 🔜 🔌 👈 💽.
    
    🖼, 🔐 🔢 `items`:
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 25.2K bytes
    - Viewed (1)
Back to top