Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for create_engine (0.22 sec)

  1. docs_src/sql_databases/tutorial002_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class HeroBase(SQLModel):
        name: str = Field(index=True)
        age: Union[int, None] = Field(default=None, index=True)
    
    
    class Hero(HeroBase, table=True):
        id: Union[int, None] = Field(default=None, primary_key=True)
        secret_name: str
    
    
    class HeroPublic(HeroBase):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  2. docs_src/sql_databases/tutorial001_an_py310.py

    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: int | None = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    sqlite_url = f"sqlite:///{sqlite_file_name}"
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  3. docs_src/sql_databases/tutorial002_py310.py

    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class HeroBase(SQLModel):
        name: str = Field(index=True)
        age: int | None = Field(default=None, index=True)
    
    
    class Hero(HeroBase, table=True):
        id: int | None = Field(default=None, primary_key=True)
        secret_name: str
    
    
    class HeroPublic(HeroBase):
        id: int
    
    
    class HeroCreate(HeroBase):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.5K bytes
    - Viewed (0)
  4. docs_src/sql_databases/tutorial001_py310.py

    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: int | None = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    sqlite_url = f"sqlite:///{sqlite_file_name}"
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  5. docs_src/dependencies/tutorial013_an_py310.py

    import time
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    from fastapi.responses import StreamingResponse
    from sqlmodel import Field, Session, SQLModel, create_engine
    
    engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db")
    
    
    class User(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str
    
    
    app = FastAPI()
    
    
    def get_session():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 937 bytes
    - Viewed (0)
  6. docs_src/sql_databases/tutorial001_py39.py

    from typing import Union
    
    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: Union[int, None] = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: Union[int, None] = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.8K bytes
    - Viewed (0)
  7. docs_src/sql_databases/tutorial002_py39.py

    from typing import Union
    
    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class HeroBase(SQLModel):
        name: str = Field(index=True)
        age: Union[int, None] = Field(default=None, index=True)
    
    
    class Hero(HeroBase, table=True):
        id: Union[int, None] = Field(default=None, primary_key=True)
        secret_name: str
    
    
    class HeroPublic(HeroBase):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  8. docs_src/dependencies/tutorial014_an_py310.py

    import time
    from typing import Annotated
    
    from fastapi import Depends, FastAPI, HTTPException
    from fastapi.responses import StreamingResponse
    from sqlmodel import Field, Session, SQLModel, create_engine
    
    engine = create_engine("postgresql+psycopg://postgres:postgres@localhost/db")
    
    
    class User(SQLModel, table=True):
        id: int | None = Field(default=None, primary_key=True)
        name: str
    
    
    app = FastAPI()
    
    
    def get_session():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Sep 29 03:29:38 UTC 2025
    - 957 bytes
    - Viewed (0)
  9. docs_src/sql_databases/tutorial001_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import Depends, FastAPI, HTTPException, Query
    from sqlmodel import Field, Session, SQLModel, create_engine, select
    
    
    class Hero(SQLModel, table=True):
        id: Union[int, None] = Field(default=None, primary_key=True)
        name: str = Field(index=True)
        age: Union[int, None] = Field(default=None, index=True)
        secret_name: str
    
    
    sqlite_file_name = "database.db"
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Oct 09 19:44:42 UTC 2024
    - 1.7K bytes
    - Viewed (0)
  10. tests/test_tutorial/test_sql_databases/test_tutorial001.py

    import importlib
    import warnings
    
    import pytest
    from dirty_equals import IsInt
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    from sqlalchemy import StaticPool
    from sqlmodel import SQLModel, create_engine
    from sqlmodel.main import default_registry
    
    from tests.utils import needs_py310
    
    
    def clear_sqlmodel():
        # Clear the tables in the metadata for the default base model
        SQLModel.metadata.clear()
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 14K bytes
    - Viewed (0)
Back to top