Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 250 for get_db (0.09 sec)

  1. docs_src/sql_databases_peewee/sql_app/main.py

        database.db._state.reset()
    
    
    def get_db(db_state=Depends(reset_db_state)):
        try:
            database.db.connect()
            yield
        finally:
            if not database.db.is_closed():
                database.db.close()
    
    
    @app.post("/users/", response_model=schemas.User, dependencies=[Depends(get_db)])
    def create_user(user: schemas.UserCreate):
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 2.2K bytes
    - Viewed (0)
  2. docs_src/dependencies/tutorial010.py

        def __init__(self):
            self.db = DBSession()
    
        def __enter__(self):
            return self.db
    
        def __exit__(self, exc_type, exc_value, traceback):
            self.db.close()
    
    
    async def get_db():
        with MySuperContextManager() as db:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 292 bytes
    - Viewed (0)
  3. docs_src/dependencies/tutorial007.py

    async def get_db():
        db = DBSession()
        try:
            yield db
        finally:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Mar 26 19:09:53 UTC 2020
    - 99 bytes
    - Viewed (0)
  4. 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}.
    
    ///
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 25K bytes
    - Viewed (0)
  5. 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/)
    
    ///
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 27.1K bytes
    - Viewed (0)
  6. tests/test_custom_route_class.py

    router_b = APIRouter(route_class=APIRouteB)
    router_c = APIRouter(route_class=APIRouteC)
    
    
    @router_a.get("/")
    def get_a():
        return {"msg": "A"}
    
    
    @router_b.get("/")
    def get_b():
        return {"msg": "B"}
    
    
    @router_c.get("/")
    def get_c():
        return {"msg": "C"}
    
    
    router_b.include_router(router=router_c, prefix="/c")
    router_a.include_router(router=router_b, prefix="/b")
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jun 30 18:25:16 UTC 2023
    - 3.1K bytes
    - Viewed (0)
  7. src/main/java/jcifs/util/Crypto.java

         */
        public static MessageDigest getMD4 () {
            try {
                return MessageDigest.getInstance("MD4", getProvider());
            }
            catch ( NoSuchAlgorithmException e ) {
                throw new CIFSUnsupportedCryptoException(e);
            }
        }
    
    
        /**
         * 
         * @return MD5 digest
         */
        public static MessageDigest getMD5 () {
            try {
    Registered: Sun Nov 03 00:10:13 UTC 2024
    - Last Modified: Tue Aug 17 17:34:29 UTC 2021
    - 5.2K bytes
    - Viewed (0)
  8. tests/test_default_response_class.py

    def get_a_a_path_override():
        return "Hello A A"
    
    
    @router_a_b_override.get("/")
    def get_a_b():
        return "Hello A B"
    
    
    @router_a_b_override.get("/override", response_class=HTMLResponse)
    def get_a_b_path_override():
        return "Hello A B"
    
    
    @router_b_override.get("/")
    def get_b():
        return "Hello B"
    
    
    @router_b_override.get("/override", response_class=HTMLResponse)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Mar 01 20:49:20 UTC 2020
    - 5.2K bytes
    - Viewed (0)
  9. tests/test_default_response_class_router.py

    def get_a_a_path_override():
        return "Hello A A"
    
    
    @router_a_b_override.get("/")
    def get_a_b():
        return "Hello A B"
    
    
    @router_a_b_override.get("/override", response_class=HTMLResponse)
    def get_a_b_path_override():
        return "Hello A B"
    
    
    @router_b_override.get("/")
    def get_b():
        return "Hello B"
    
    
    @router_b_override.get("/override", response_class=HTMLResponse)
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Mar 01 20:49:20 UTC 2020
    - 5K bytes
    - Viewed (0)
  10. compat/maven-compat/src/main/java/org/apache/maven/profiles/activation/JdkPrefixProfileActivator.java

            return JDK_VERSION;
        }
    
        protected boolean canDetectActivation(Profile profile) {
            return profile.getActivation() != null
                    && profile.getActivation().getJdk() != null
                    && !profile.getActivation().getJdk().isEmpty();
        }
    Registered: Sun Nov 03 03:35:11 UTC 2024
    - Last Modified: Fri Oct 25 12:31:46 UTC 2024
    - 3K bytes
    - Viewed (0)
Back to top