I have aPython FastAPI auth service, it uses layer architecture and work with DB goes through the Repository layer. The work with database itself is written using sqlalchemy and library databases. But databases library has stopped support of newer versions of sql alchemy because of that I want to get rid of this library and use just a newer SQL ALchemy as it has enough abilities. I will share with you my previous database.py file as well as one of the repositories, and I want you to rewrite it without using databases library with just SQL alcheny, but I want to save the same abstraction lavel. So after those changes I don't need to change anything in my code and a can use repository same way as before.
Here is database.py:
from uuid import uuid4

from databases import Database
from sqlalchemy import (
    ARRAY,
    Boolean,
    Column,
    DateTime,
    ForeignKey,
    Identity,
    Integer,
    LargeBinary,
    MetaData,
    String,
    Table,
    create_engine,
    func,
)
from sqlalchemy.dialects.postgresql import UUID

from src.config import settings
from src.constants import DB_NAMING_CONVENTION

DATABASE_URL = str(settings.DATABASE_URL)
engine = create_engine(DATABASE_URL)
metadata = MetaData(naming_convention=DB_NAMING_CONVENTION)
database = Database(DATABASE_URL, force_rollback=settings.ENVIRONMENT.is_testing)


auth_user = Table(
    "auth_user",
    metadata,
    Column("id", Integer, Identity()),
    Column("uuid", UUID, unique=True, primary_key=True, default=uuid4()),
    Column("name", String, nullable=True),
    Column("email", String, unique=True, nullable=True),
    Column("apple_id", String, unique=True, nullable=True),
    Column("google_id", String, unique=True, nullable=True),
    Column("wallet_address", String, unique=True, nullable=True),
    Column("created_at", DateTime, server_default=func.now(), nullable=False),
    Column("updated_at", DateTime, onupdate=func.now()),
    Column("last_active_at", DateTime, nullable=True),
    Column("is_admin", Boolean, server_default="false", nullable=False),
)

client_application = Table(
    "client_application",
    metadata,
    Column("client_id", UUID, unique=True, primary_key=True, default=uuid4()),
    Column("client_secret", LargeBinary, nullable=False),
    Column("client_name", String, nullable=False),
    Column("redirect_uris", ARRAY(String)),
)


discord = Table(
    "discord",
    metadata,
    Column("uuid", UUID, unique=True, primary_key=True, default=uuid4()),
    Column(
        "user_uuid",
        ForeignKey("auth_user.uuid", ondelete="CASCADE"),
        nullable=False,
        unique=True,
    ),
    Column("id", String, nullable=False, unique=True),
    Column("user_name", String, nullable=False),
)


twitter = Table(
    "twitter",
    metadata,
    Column("uuid", UUID, unique=True, primary_key=True, default=uuid4()),
    Column(
        "user_uuid",
        ForeignKey("auth_user.uuid", ondelete="CASCADE"),
        nullable=False,
        unique=True,
    ),
    Column("id", String, nullable=False, unique=True),
    Column("name", String, nullable=True),
    Column("user_name", String, nullable=False),
    Column("profile_image_url", String, nullable=True),
)

And here is my user_repository that uses this database:

import uuid
from datetime import datetime
from typing import Any, Dict, List, Optional

from asyncpg import PostgresError
from databases import Database
from databases.interfaces import Record
from sqlalchemy import insert, select
from sqlalchemy.exc import SQLAlchemyError

from src.database import auth_user
from src.exceptions import UserRepositoryError
from src.user.models import User

__all__ = ["UserRepository"]


class UserRepository:
    def __init__(self, db: Database):
        self._db = db
        self._write_fields = [
            "name",
            "email",
            "is_admin",
            "apple_id",
            "google_id",
            "wallet_address",
            "last_active_at",
        ]
        self._read_fields = [
            "id",
            "uuid",
            "name",
            "email",
            "is_admin",
            "apple_id",
            "google_id",
            "wallet_address",
            "created_at",
            "updated_at",
            "last_active_at",
        ]

    async def _get(self, filters: Dict[str, Any]) -> Optional[User]:
        select_query = select(auth_user)
        for field, value in filters.items():
            if field in self._read_fields:
                select_query = select_query.where(getattr(auth_user.c, field) == value)
        try:
            row = await self._db.fetch_one(select_query)
        except (SQLAlchemyError, PostgresError):
            raise UserRepositoryError
        if row:
            return self._to_object(row)
        return

    async def _get_batch(self, ids: List[Any], filters: Dict[str, Any]) -> List[User]:
        select_query = select(auth_user).where(auth_user.c.uuid.in_(ids))
        for field, value in filters.items():
            if field in self._read_fields:
                select_query = select_query.where(getattr(auth_user.c, field) == value)
        try:
            rows = await self._db.fetch_all(select_query)
        except (SQLAlchemyError, PostgresError):
            raise UserRepositoryError
        if rows:
            users = [self._to_object(row) for row in rows]
            return users
        return []

    async def _get_batch(self, ids: List[Any], filters: Dict[str, Any]) -> List[User]:
        select_query = select(auth_user).where(auth_user.c.uuid.in_(ids))
        for field, value in filters.items():
            if field in self._read_fields:
                select_query = select_query.where(getattr(auth_user.c, field) == value)
        try:
            rows = await self._db.fetch_all(select_query)
        except (SQLAlchemyError, PostgresError):
            raise UserRepositoryError
        if rows:
            users = [self._to_object(row) for row in rows]
            return users
        return []

    async def _update(self, user: User, fields: Optional[List[str]] = None) -> None:
        if not fields:
            fields = self._write_fields

        if fields:
            valid_fields = {field for field in fields if field in self._write_fields}
            update_values = user.model_dump(include=valid_fields)

            if update_values:
                update_query = (
                    auth_user.update()
                    .values(update_values)
                    .where(auth_user.c.uuid == user.uuid)
                )
                try:
                    await self._db.execute(update_query)
                except (SQLAlchemyError, PostgresError):
                    raise UserRepositoryError

    async def _create(self, values: Dict[str, Any]) -> User:
        insert_values = {
            key: value for key, value in values.items() if key in self._write_fields
        }
        insert_values.update({"uuid": uuid.uuid4(), "created_at": datetime.utcnow()})
        insert_query = insert(auth_user).values(insert_values).returning(auth_user)
        try:
            row = await self._db.fetch_one(insert_query)
            if not row:
                raise UserRepositoryError
        except (SQLAlchemyError, PostgresError):
            raise UserRepositoryError
        return self._to_object(row)

    async def get_by_uuid(self, user_uuid: uuid.UUID) -> Optional[User]:
        filters = {"uuid": user_uuid}
        return await self._get(filters)

    async def get_by_email(self, email: str) -> Optional[User]:
        filters = {"email": email.lower()}
        return await self._get(filters)

    async def get_by_wallet_address(self, wallet_address: str) -> Optional[User]:
        filters = {"wallet_address": wallet_address}
        return await self._get(filters)

    async def get_by_apple_id(self, apple_id: str) -> Optional[User]:
        filters = {"apple_id": apple_id}
        return await self._get(filters)

    async def get_by_google_id(self, google_id: str) -> Optional[User]:
        filters = {"google_id": google_id}
        return await self._get(filters)

    async def get_batch_by_uuid(self, user_uuids: List[uuid.UUID]) -> List[User]:
        return await self._get_batch(ids=user_uuids, filters={})

    async def set_email(self, user: User, email: str) -> None:
        user.email = email
        await self._update(user, fields=["email"])

    async def set_name(self, user: User, name: str) -> None:
        user.name = name
        await self._update(user, fields=["name"])

    async def set_google_id(self, user: User, google_id: str) -> None:
        user.google_id = google_id
        await self._update(user, fields=["google_id"])

    async def set_apple_id(self, user: User, apple_id: str) -> None:
        user.apple_id = apple_id
        await self._update(user, fields=["apple_id"])

    async def set_wallet_address(self, user: User, wallet_address: str) -> None:
        user.wallet_address = wallet_address
        await self._update(user, fields=["wallet_address"])

    async def set_activity_date(self, user: User, activity_date: datetime) -> None:
        user.last_active_at = activity_date
        await self._update(user, fields=["last_active_at"])

    async def create_with_email(self, email: str) -> User:
        values = {"email": email.lower()}
        return await self._create(values)

    async def create_with_google(self, google_id: str, email: str) -> User:
        values = {"google_id": google_id, "email": email.lower()}
        return await self._create(values)

    async def create_with_apple(self, apple_id: str, email: str) -> User:
        values = {"apple_id": apple_id, "email": email.lower()}
        return await self._create(values)

    async def create_with_wallet(self, wallet_address: str) -> User:
        values = {"wallet_address": wallet_address}
        return await self._create(values)

    @classmethod
    def _to_object(cls, row: Record) -> User:
        return User(
            id=row["id"],
            uuid=row["uuid"],
            name=row["name"],
            email=row["email"],
            is_admin=row["is_admin"],
            apple_id=row["apple_id"],
            google_id=row["google_id"],
            wallet_address=row["wallet_address"],
            created_at=row["created_at"],
            updated_at=row["updated_at"],
            last_active_at=row["last_active_at"],
        )