Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 30 for bindIf (0.25 sec)

  1. docs_src/sql_databases/sql_app_py39/tests/test_sql_app.py

    SQLALCHEMY_DATABASE_URL = "sqlite:///./test.db"
    
    engine = create_engine(
        SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
    )
    TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
    
    
    Base.metadata.create_all(bind=engine)
    
    
    def override_get_db():
        try:
            db = TestingSessionLocal()
            yield db
        finally:
            db.close()
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.2K bytes
    - Viewed (0)
  2. docs/em/docs/advanced/testing-database.md

        🦁 & 🎯 🔛 🎯 🔬 📟, 👥 🖨 ⚫️.
    
    ## ✍ 💽
    
    ↩️ 🔜 👥 🔜 ⚙️ 🆕 💽 🆕 📁, 👥 💪 ⚒ 💭 👥 ✍ 💽 ⏮️:
    
    ```Python
    Base.metadata.create_all(bind=engine)
    ```
    
    👈 🛎 🤙 `main.py`, ✋️ ⏸ `main.py` ⚙️ 💽 📁 `sql_app.db`, & 👥 💪 ⚒ 💭 👥 ✍ `test.db` 💯.
    
    👥 🚮 👈 ⏸ 📥, ⏮️ 🆕 📁.
    
    ```Python hl_lines="16"
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 2.6K bytes
    - Viewed (0)
  3. docs/pt/docs/deployment.md

        ```
    
        </div>
    
    === "Hypercorn"
    
        <div class="termy">
    
        ```console
        $ hypercorn main:app --bind 0.0.0.0:80
    
        Running on 0.0.0.0:8080 over http (CTRL + C to quit)
        ```
    
        </div>
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 18 16:16:54 GMT 2022
    - 16.8K bytes
    - Viewed (0)
  4. docs_src/sql_databases/sql_app/tests/test_sql_app.py

    engine = create_engine(
        SQLALCHEMY_DATABASE_URL,
        connect_args={"check_same_thread": False},
        poolclass=StaticPool,
    )
    TestingSessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
    
    
    Base.metadata.create_all(bind=engine)
    
    
    def override_get_db():
        try:
            db = TestingSessionLocal()
            yield db
        finally:
            db.close()
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Jun 22 11:20:12 GMT 2023
    - 1.2K bytes
    - Viewed (0)
  5. docs_src/sql_databases/sql_app/database.py

    engine = create_engine(
        SQLALCHEMY_DATABASE_URL, connect_args={"check_same_thread": False}
    )
    SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Apr 05 11:53:09 GMT 2020
    - 461 bytes
    - Viewed (0)
  6. docs_src/sql_databases/sql_app_py310/main.py

    from fastapi import Depends, FastAPI, HTTPException
    from sqlalchemy.orm import Session
    
    from . import crud, models, schemas
    from .database import SessionLocal, engine
    
    models.Base.metadata.create_all(bind=engine)
    
    app = FastAPI()
    
    
    # Dependency
    def get_db():
        db = SessionLocal()
        try:
            yield db
        finally:
            db.close()
    
    
    @app.post("/users/", response_model=schemas.User)
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  7. docs/ja/docs/deployment/manually.md

        ```
    
        </div>
    
    === "Hypercorn"
    
        <div class="termy">
    
        ```console
        $ hypercorn main:app --bind 0.0.0.0:80
    
        Running on 0.0.0.0:8080 over http (CTRL + C to quit)
        ```
    
        </div>
    
    停止した場合に自動的に再起動させるツールを設定したいかもしれません。
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Aug 18 16:16:54 GMT 2022
    - 2.3K bytes
    - Viewed (0)
  8. docs/zh/docs/advanced/testing-database.md

    !!! tip "提示"
    
        为减少代码重复,最好把这段代码写成函数,在 `database.py` 与 `tests/test_sql_app.py`中使用。
    
        为了把注意力集中在测试代码上,本例只是复制了这段代码。
    
    ## 创建数据库
    
    因为现在是想在新文件中使用新数据库,所以要使用以下代码创建数据库:
    
    ```Python
    Base.metadata.create_all(bind=engine)
    ```
    
    一般是在 `main.py` 中调用这行代码,但在 `main.py` 里,这行代码用于创建 `sql_app.db`,但是现在要为测试创建 `test.db`。
    
    因此,要在测试代码中添加这行代码创建新的数据库文件。
    
    ```Python hl_lines="16"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sun Jan 28 18:09:26 GMT 2024
    - 2.8K bytes
    - Viewed (0)
  9. docs/fr/docs/deployment/manually.md

        ```
    
        </div>
    
    === "Hypercorn"
    
        <div class="termy">
    
        ```console
        $ hypercorn main:app --bind 0.0.0.0:80
    
        Running on 0.0.0.0:8080 over http (CTRL + C to quit)
        ```
    
        </div>
    
    !!! warning
         N'oubliez pas de supprimer l'option `--reload` si vous l'utilisiez.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Mar 04 12:02:09 GMT 2023
    - 5.4K bytes
    - Viewed (0)
  10. docs/em/docs/deployment/manually.md

        ```
    
        </div>
    
    === "Hypercorn"
    
        <div class="termy">
    
        ```console
        $ hypercorn main:app --bind 0.0.0.0:80
    
        Running on 0.0.0.0:8080 over http (CTRL + C to quit)
        ```
    
        </div>
    
    !!! warning
        💭 ❎ `--reload` 🎛 🚥 👆 ⚙️ ⚫️.
    
         `--reload` 🎛 🍴 🌅 🌅 ℹ, 🌅 ⚠, ♒️.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 4.3K bytes
    - Viewed (0)
Back to top