Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 228 for database (0.24 sec)

  1. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  2. docs_src/async_sql_databases/tutorial001.py

    from typing import List
    
    import databases
    import sqlalchemy
    from fastapi import FastAPI
    from pydantic import BaseModel
    
    # SQLAlchemy specific code, as with any other app
    DATABASE_URL = "sqlite:///./test.db"
    # DATABASE_URL = "postgresql://user:password@postgresserver/db"
    
    database = databases.Database(DATABASE_URL)
    
    metadata = sqlalchemy.MetaData()
    
    notes = sqlalchemy.Table(
        "notes",
        metadata,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 1.4K bytes
    - Viewed (0)
  3. docs_src/sql_databases_peewee/sql_app/main.py

    from fastapi import Depends, FastAPI, HTTPException
    
    from . import crud, database, models, schemas
    from .database import db_state_default
    
    database.db.connect()
    database.db.create_tables([models.User, models.Item])
    database.db.close()
    
    app = FastAPI()
    
    sleep_time = 10
    
    
    async def reset_db_state():
        database.db._state._state.set(db_state_default.copy())
        database.db._state.reset()
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Mar 26 19:09:53 GMT 2020
    - 2.2K bytes
    - Viewed (0)
  4. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 19.2K bytes
    - Viewed (0)
  5. api/go1.8.txt

    pkg database/sql, const LevelDefault = 0
    pkg database/sql, const LevelDefault IsolationLevel
    pkg database/sql, const LevelLinearizable = 7
    pkg database/sql, const LevelLinearizable IsolationLevel
    pkg database/sql, const LevelReadCommitted = 2
    pkg database/sql, const LevelReadCommitted IsolationLevel
    pkg database/sql, const LevelReadUncommitted = 1
    pkg database/sql, const LevelReadUncommitted IsolationLevel
    Plain Text
    - Registered: Tue Apr 30 11:13:12 GMT 2024
    - Last Modified: Wed Dec 21 05:25:57 GMT 2016
    - 16.3K bytes
    - Viewed (0)
  6. docs/em/docs/advanced/async-sql-databases.md

    * ✍ `DATABASE_URL`.
    * ✍ `database` 🎚.
    
    ```Python hl_lines="3  9  12"
    {!../../../docs_src/async_sql_databases/tutorial001.py!}
    ```
    
    !!! tip
        🚥 👆 🔗 🎏 💽 (✅ ✳), 👆 🔜 💪 🔀 `DATABASE_URL`.
    
    ## ✍ 🏓
    
    👉 💼, 👥 🏗 🏓 🎏 🐍 📁, ✋️ 🏭, 👆 🔜 🎲 💚 ✍ 👫 ⏮️ ⚗, 🛠️ ⏮️ 🛠️, ♒️.
    
    📥, 👉 📄 🔜 🏃 🔗, ▶️️ ⏭ ▶️ 👆 **FastAPI** 🈸.
    
    * ✍ `engine`.
    * ✍ 🌐 🏓 ⚪️➡️ `metadata` 🎚.
    
    ```Python hl_lines="25-28"
    Plain Text
    - Registered: Sun Mar 31 07:19:09 GMT 2024
    - Last Modified: Sat Apr 01 09:26:04 GMT 2023
    - 4K bytes
    - Viewed (0)
  7. 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)
  8. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Sat Feb 24 23:06:37 GMT 2024
    - 1.9K bytes
    - Viewed (0)
  9. docs/zh/docs/tutorial/sql-databases.md

    ---> 100%
    ```
    
    </div>
    
    ## 创建 SQLAlchemy 部件
    
    让我们转到文件`sql_app/database.py`。
    
    ### 导入 SQLAlchemy 部件
    
    ```Python hl_lines="1-3"
    {!../../../docs_src/sql_databases/sql_app/database.py!}
    ```
    
    ### 为 SQLAlchemy 定义数据库 URL地址
    
    ```Python hl_lines="5-6"
    {!../../../docs_src/sql_databases/sql_app/database.py!}
    ```
    
    在这个例子中,我们正在“连接”到一个 SQLite 数据库(用 SQLite 数据库打开一个文件)。
    
    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)
  10. docs_src/sql_databases/sql_app_py310/tests/test_sql_app.py

    from fastapi.testclient import TestClient
    from sqlalchemy import create_engine
    from sqlalchemy.orm import sessionmaker
    
    from ..database import Base
    from ..main import app, get_db
    
    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)
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jan 07 14:11:31 GMT 2022
    - 1.2K bytes
    - Viewed (0)
Back to top