Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 153 for Database (0.21 sec)

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

    └── sql_app
        ├── __init__.py
        ├── crud.py
        ├── database.py
        ├── main.py
        ├── models.py
        ├── schemas.py
        └── tests
            ├── __init__.py
            └── test_sql_app.py
    ```
    
    ## 创建新的数据库会话
    
    首先,为新建数据库创建新的数据库会话。
    
    测试时,使用 `test.db` 替代 `sql_app.db`。
    
    但其余的会话代码基本上都是一样的,只要复制就可以了。
    
    ```Python hl_lines="8-13"
    {!../../../docs_src/sql_databases/sql_app/tests/test_sql_app.py!}
    ```
    
    !!! tip "提示"
    
    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)
  2. docs/en/docs/advanced/testing-database.md

    .
    └── sql_app
        ├── __init__.py
        ├── crud.py
        ├── database.py
        ├── main.py
        ├── models.py
        ├── schemas.py
        └── tests
            ├── __init__.py
            └── test_sql_app.py
    ```
    
    ## Create the new database session
    
    First, we create a new database session with the new database.
    
    We'll use an in-memory database that persists during the tests instead of the local file `sql_app.db`.
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Fri Jul 07 17:12:13 GMT 2023
    - 3.5K bytes
    - Viewed (0)
  3. docs/en/docs/tutorial/sql-databases.md

    Let's refer to the file `sql_app/database.py`.
    
    ### Import the SQLAlchemy parts
    
    ```Python hl_lines="1-3"
    {!../../../docs_src/sql_databases/sql_app/database.py!}
    ```
    
    ### Create a database URL for SQLAlchemy
    
    ```Python hl_lines="5-6"
    {!../../../docs_src/sql_databases/sql_app/database.py!}
    ```
    
    In this example, we are "connecting" to a SQLite database (opening a file with the SQLite database).
    
    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/en/docs/how-to/sql-databases-peewee.md

    * `sql_app/__init__.py`: is an empty file.
    
    * `sql_app/database.py`:
    
    ```Python
    {!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
    ```
    
    * `sql_app/models.py`:
    
    ```Python
    {!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
    ```
    
    * `sql_app/schemas.py`:
    
    ```Python
    {!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
    ```
    
    * `sql_app/crud.py`:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 23.6K bytes
    - Viewed (0)
  5. docs/en/docs/how-to/nosql-databases-couchbase.md

    They are generally all related to the same application.
    
    The analogy in the relational database world would be a "database" (a specific database, not the database server).
    
    The analogy in **MongoDB** would be a "collection".
    
    In the code, a `Bucket` represents the main entrypoint of communication with the database.
    
    This utility function will:
    
    * Connect to a **Couchbase** cluster (that might be a single machine).
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Tue Jan 16 13:23:25 GMT 2024
    - 6K bytes
    - Viewed (0)
  6. docs/en/docs/how-to/async-sql-encode-databases.md

    {!../../../docs_src/async_sql_databases/tutorial001.py!}
    ```
    
    !!! tip
        Notice that all this code is pure SQLAlchemy Core.
    
        `databases` is not doing anything here yet.
    
    ## Import and set up `databases`
    
    * Import `databases`.
    * Create a `DATABASE_URL`.
    * Create a `database` object.
    
    ```Python hl_lines="3  9  12"
    {!../../../docs_src/async_sql_databases/tutorial001.py!}
    ```
    
    !!! tip
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  7. docs/em/docs/how-to/sql-databases-peewee.md

    `sql_app` 🔜 ✔️ 📄 📁:
    
    * `sql_app/__init__.py`: 🛁 📁.
    
    * `sql_app/database.py`:
    
    ```Python
    {!../../../docs_src/sql_databases_peewee/sql_app/database.py!}
    ```
    
    * `sql_app/models.py`:
    
    ```Python
    {!../../../docs_src/sql_databases_peewee/sql_app/models.py!}
    ```
    
    * `sql_app/schemas.py`:
    
    ```Python
    {!../../../docs_src/sql_databases_peewee/sql_app/schemas.py!}
    ```
    
    * `sql_app/crud.py`:
    
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  8. docs/zh/docs/advanced/async-sql-databases.md

    * 创建 `DATABASE_URL`
    * 创建 `database`
    
    ```Python hl_lines="3  9  12"
    {!../../../docs_src/async_sql_databases/tutorial001.py!}
    ```
    
    !!! tip "提示"
    
        连接 PostgreSQL 等数据库时,需要修改 `DATABASE_URL`。
    
    ## 创建表
    
    本例中,使用 Python 文件创建表,但在生产环境中,应使用集成迁移等功能的 Alembic 创建表。
    
    本例在启动 **FastAPI** 应用前,直接执行这些操作。
    
    * 创建 `engine`
    * 使用 `metadata` 对象创建所有表
    
    ```Python hl_lines="25-28"
    Plain Text
    - Registered: Sun Mar 31 07:19:09 GMT 2024
    - Last Modified: Sat Mar 30 22:44:40 GMT 2024
    - 4.3K bytes
    - Viewed (0)
  9. tests/test_dependency_normal_exceptions.py

    initial_fake_database = {"rick": "Rick Sanchez"}
    
    fake_database = initial_fake_database.copy()
    
    initial_state = {"except": False, "finally": False}
    
    state = initial_state.copy()
    
    app = FastAPI()
    
    
    async def get_database():
        temp_database = fake_database.copy()
        try:
            yield temp_database
            fake_database.update(temp_database)
        except HTTPException:
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  10. docs/en/docs/project-generation.md

        - 🧰 [SQLModel](https://sqlmodel.tiangolo.com) for the Python SQL database interactions (ORM).
        - 🔍 [Pydantic](https://docs.pydantic.dev), used by FastAPI, for the data validation and settings management.
        - 💾 [PostgreSQL](https://www.postgresql.org) as the SQL database.
    - 🚀 [React](https://react.dev) for the frontend.
    Plain Text
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Mar 21 21:12:21 GMT 2024
    - 1.8K bytes
    - Viewed (0)
Back to top