Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 19 for get_db (0.19 sec)

  1. docs/en/docs/advanced/testing-database.md

    ```Python hl_lines="19-24  27"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    !!! tip
        The code for `override_get_db()` is almost exactly the same as for `get_db()`, but in `override_get_db()` we use the `TestingSessionLocal` for the testing database instead.
    
    ## Test the app
    
    Then we can just test the app as normally.
    
    ```Python hl_lines="32-47"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  2. docs/zh/docs/advanced/testing-database.md

    ```
    
    ## 覆盖依赖项
    
    接下来,创建覆盖依赖项,并为应用添加覆盖内容。
    
    ```Python hl_lines="19-24  27"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    !!! tip "提示"
    
        `overrider_get_db()` 与 `get_db` 的代码几乎完全一样,只是 `overrider_get_db` 中使用测试数据库的 `TestingSessionLocal`。
    
    ## 测试应用
    
    然后,就可以正常测试了。
    
    ```Python hl_lines="32-47"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sun Jan 28 18:09:26 GMT 2024
    - 2.8K bytes
    - Viewed (0)
  3. docs/em/docs/advanced/testing-database.md

    ```
    
    ## 🔗 🔐
    
    🔜 👥 ✍ 🔗 🔐 & 🚮 ⚫️ 🔐 👆 📱.
    
    ```Python hl_lines="19-24  27"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    !!! tip
        📟 `override_get_db()` 🌖 ⚫️❔ 🎏 `get_db()`, ✋️ `override_get_db()` 👥 ⚙️ `TestingSessionLocal` 🔬 💽 ↩️.
    
    ## 💯 📱
    
    ⤴️ 👥 💪 💯 📱 🛎.
    
    ```Python hl_lines="32-47"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  4. docs/en/docs/how-to/sql-databases-peewee.md

    For that, we need to create another `async` dependency `reset_db_state()` that is used as a sub-dependency in `get_db()`. It will set the value for the context variable (with just a default `dict`) that will be used as the database state for the whole request. And then the dependency `get_db()` will store in it the database state (connection, transactions, etc).
    
    ```Python hl_lines="18-20"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (1)
  5. docs/em/docs/how-to/sql-databases-peewee.md

    👈, 👥 💪 ✍ ➕1️⃣ `async` 🔗 `reset_db_state()` 👈 ⚙️ 🎧-🔗 `get_db()`. ⚫️ 🔜 ⚒ 💲 🔑 🔢 (⏮️ 🔢 `dict`) 👈 🔜 ⚙️ 💽 🇵🇸 🎂 📨. & ⤴️ 🔗 `get_db()` 🔜 🏪 ⚫️ 💽 🇵🇸 (🔗, 💵, ♒️).
    
    ```Python hl_lines="18-20"
    {!../../../docs_src/sql_databases_peewee/sql_app/main.py!}
    ```
    
    **⏭ 📨**, 👥 🔜 ⏲ 👈 🔑 🔢 🔄 `async` 🔗 `reset_db_state()` & ⤴️ ✍ 🆕 🔗 `get_db()` 🔗, 👈 🆕 📨 🔜 ✔️ 🚮 👍 💽 🇵🇸 (🔗, 💵, ♒️).
    
    !!! tip
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/sql-databases.md

    ```
    
    然后我们应该声明*路径操作函数*和不带 的依赖关系`async def`,只需使用普通的`def`,如下:
    
    ```Python hl_lines="2"
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        ...
    ```
    
    !!! info
        如果您需要异步连接到关系数据库,请参阅[Async SQL (Relational) Databases](https://fastapi.tiangolo.com/zh/advanced/async-sql-databases/)
    
    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)
  7. docs/em/docs/tutorial/sql-databases.md

    ```
    
    ⤴️ 👥 🔜 📣 *➡ 🛠️ 🔢* & 🔗 🍵 `async def`, ⏮️ 😐 `def`,:
    
    ```Python hl_lines="2"
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        ...
    ```
    
    !!! info
        🚥 👆 💪 🔗 👆 🔗 💽 🔁, 👀 [🔁 🗄 (🔗) 💽](../advanced/async-sql-databases.md){.internal-link target=_blank}.
    
    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)
  8. docs/en/docs/tutorial/sql-databases.md

    ```Python hl_lines="2"
    @app.get("/users/{user_id}", response_model=schemas.User)
    def read_user(user_id: int, db: Session = Depends(get_db)):
        db_user = crud.get_user(db, user_id=user_id)
        ...
    ```
    
    !!! info
    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)
  9. okhttp-testing-support/src/main/kotlin/okhttp3/DelegatingSSLSession.kt

    import javax.security.cert.X509Certificate
    
    /** An [SSLSession] that delegates all calls.  */
    abstract class DelegatingSSLSession(protected val delegate: SSLSession?) : SSLSession {
      override fun getId(): ByteArray {
        return delegate!!.id
      }
    
      override fun getSessionContext(): SSLSessionContext {
        return delegate!!.sessionContext
      }
    
      override fun getCreationTime(): Long {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Mon Jan 08 01:13:22 GMT 2024
    - 2.8K bytes
    - Viewed (0)
  10. api/go1.14.txt

    pkg syscall (freebsd-arm64), const F_DUPFD_CLOEXEC = 17
    pkg syscall (freebsd-arm64), const F_DUPFD_CLOEXEC ideal-int
    pkg syscall (freebsd-arm64), const F_GETFD = 1
    pkg syscall (freebsd-arm64), const F_GETFD ideal-int
    pkg syscall (freebsd-arm64), const F_GETFL = 3
    pkg syscall (freebsd-arm64), const F_GETFL ideal-int
    pkg syscall (freebsd-arm64), const F_GETLK = 11
    Plain Text
    - Registered: Tue May 07 11:14:38 GMT 2024
    - Last Modified: Fri Feb 17 20:31:46 GMT 2023
    - 508.9K bytes
    - Viewed (0)
Back to top