- Sort Score
- Result 10 results
- Languages All
Results 11 - 19 of 19 for check_same_thread (0.21 sec)
-
docs_src/sql_databases/tutorial001_an_py39.py
age: Union[int, None] = Field(default=None, index=True) secret_name: str sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" connect_args = {"check_same_thread": False} engine = create_engine(sqlite_url, connect_args=connect_args) def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 1.7K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002.py
name: Union[str, None] = None age: Union[int, None] = None secret_name: Union[str, None] = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" connect_args = {"check_same_thread": False} engine = create_engine(sqlite_url, connect_args=connect_args) def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.6K bytes - Viewed (0) -
docs_src/sql_databases/tutorial002_an_py310.py
name: str | None = None age: int | None = None secret_name: str | None = None sqlite_file_name = "database.db" sqlite_url = f"sqlite:///{sqlite_file_name}" connect_args = {"check_same_thread": False} engine = create_engine(sqlite_url, connect_args=connect_args) def create_db_and_tables(): SQLModel.metadata.create_all(engine) def get_session(): with Session(engine) as session:
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 2.5K bytes - Viewed (0) -
docs/pt/docs/tutorial/sql-databases.md
Você teria **um único objeto `engine`** para todo o seu código se conectar ao mesmo banco de dados. {* ../../docs_src/sql_databases/tutorial001_an_py310.py ln[14:18] hl[14:15,17:18] *} Usar `check_same_thread=False` permite que o FastAPI use o mesmo banco de dados SQLite em diferentes threads. Isso é necessário, pois **uma única requisição** pode usar **mais de uma thread** (por exemplo, em dependências).
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 27 15:25:29 UTC 2024 - 15.8K bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_tutorial001.py
clear_sqlmodel() importlib.reload(mod) mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args={"check_same_thread": False}, poolclass=StaticPool ) with TestClient(mod.app) as c: yield c def test_crud_app(client: TestClient):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 14.8K bytes - Viewed (0) -
docs/en/docs/tutorial/sql-databases.md
Using `check_same_thread=False` allows FastAPI to use the same SQLite database in different threads. This is necessary as **one single request** could use **more than one thread** (for example in dependencies). Don't worry, with the way the code is structured, we'll make sure we use **a single SQLModel *session* per request** later, this is actually what the `check_same_thread` is trying to achieve. ### Create the Tables
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 14.7K bytes - Viewed (0) -
tests/test_tutorial/test_sql_databases/test_tutorial002.py
clear_sqlmodel() importlib.reload(mod) mod.sqlite_url = "sqlite://" mod.engine = create_engine( mod.sqlite_url, connect_args={"check_same_thread": False}, poolclass=StaticPool ) with TestClient(mod.app) as c: yield c def test_crud_app(client: TestClient):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Wed Oct 09 19:44:42 UTC 2024 - 19.9K bytes - Viewed (0) -
docs/em/docs/tutorial/sql-databases.md
#### 🗒 ❌: ```Python connect_args={"check_same_thread": False} ``` ...💪 🕴 `SQLite`. ⚫️ 🚫 💪 🎏 💽. /// info | "📡 ℹ" 🔢 🗄 🔜 🕴 ✔ 1️⃣ 🧵 🔗 ⏮️ ⚫️, 🤔 👈 🔠 🧵 🔜 🍵 🔬 📨. 👉 ❎ 😫 🤝 🎏 🔗 🎏 👜 (🎏 📨). ✋️ FastAPI, ⚙️ 😐 🔢 (`def`) 🌅 🌘 1️⃣ 🧵 💪 🔗 ⏮️ 💽 🎏 📨, 👥 💪 ⚒ 🗄 💭 👈 ⚫️ 🔜 ✔ 👈 ⏮️ `connect_args={"check_same_thread": False}`.
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 25K bytes - Viewed (0) -
docs/zh/docs/tutorial/sql-databases.md
``` #### 注意 参数: ```Python connect_args={"check_same_thread": False} ``` ...仅用于`SQLite`,在其他数据库不需要它。 /// info | "技术细节" 默认情况下,SQLite 只允许一个线程与其通信,假设有多个线程的话,也只将处理一个独立的请求。 这是为了防止意外地为不同的事物(不同的请求)共享相同的连接。 但是在 FastAPI 中,使用普通函数(def)时,多个线程可以为同一个请求与数据库交互,所以我们需要使用`connect_args={"check_same_thread": False}`来让SQLite允许这样。 此外,我们将确保每个请求都在依赖项中获得自己的数据库连接会话,因此不需要该默认机制。 ///
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Sun Oct 06 20:36:54 UTC 2024 - 27.1K bytes - Viewed (0)