We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
https://github.com/sqlalchemy/sqlalchemy/discussions/11692
sqlalchemy.exc.CompileError: (in table 'users', column 'id'): SQLite does not support autoincrement for composite primary keys
class User(Base): __tablename__ = "users" id: Mapped[int] = mapped_column( "id", autoincrement=True, nullable=False, unique=True, primary_key=True, init=False, ) name: Mapped[str] = mapped_column(String(30)) username: Mapped[str] = mapped_column(String(20), unique=True, index=True) email: Mapped[str] = mapped_column(String(50), unique=True, index=True) hashed_password: Mapped[str] = mapped_column(String) role: Mapped[str] = mapped_column(String(10), unique=True, index=True) uuid: Mapped[uuid_pkg.UUID] = mapped_column( default_factory=uuid_pkg.uuid4, primary_key=True, unique=True ) created_at: Mapped[datetime] = mapped_column( DateTime(timezone=True), default_factory=lambda: datetime.now(UTC) ) updated_at: Mapped[datetime | None] = mapped_column( DateTime(timezone=True), default=None ) deleted_at: Mapped[datetime | None] = mapped_column( DateTime(timezone=True), default=None ) is_deleted: Mapped[bool] = mapped_column(default=False, index=True) @pytest.fixture(name="session") async def session_fixture() -> AsyncGenerator[AsyncSession, None]: async_engine = create_async_engine( "sqlite+aiosqlite://", echo=True, connect_args={"check_same_thread": False}, poolclass=StaticPool, ) async with async_engine.begin() as conn: await conn.run_sync(Base.metadata.create_all) async_session_maker = async_sessionmaker( bind=async_engine, expire_on_commit=False ) async with async_session_maker() as session: yield session
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://github.com/sqlalchemy/sqlalchemy/discussions/11692
sqlalchemy.exc.CompileError: (in table 'users', column 'id'): SQLite does not support autoincrement for composite primary keys
The text was updated successfully, but these errors were encountered: