Repository: litestar-org/litestar

Issue:
StaticFilesConfig and virtual directories
I'm trying to write a ``FileSystemProtocol`` to load files from the package data using [importlib_resources](https://importlib-resources.readthedocs.io/en/latest/using.html#). But because ``directories`` is defined as ``DirectoryPath``, pydantic checks if the given directories exist in the local filesystem. 

This is not generally true, especially in any kind of virtual filesystem (e.g. a zipped package). I think this condition should be relaxed to support virtual filesystems.

https://github.com/starlite-api/starlite/blob/9bb6dcd57c10a591377cf8e3a537e9292566d5b9/starlite/config/static_files.py#L32


Discussion:
I agree. Do you want to submit a PR?

Resolving patch:
diff --git a/litestar/contrib/sqlalchemy/repository/_async.py b/litestar/contrib/sqlalchemy/repository/_async.py
--- a/litestar/contrib/sqlalchemy/repository/_async.py
+++ b/litestar/contrib/sqlalchemy/repository/_async.py
@@ -2,7 +2,7 @@
 
 from typing import TYPE_CHECKING, Any, Generic, Iterable, Literal, cast
 
-from sqlalchemy import Result, Select, delete, over, select, text, update
+from sqlalchemy import Result, Select, TextClause, delete, over, select, text, update
 from sqlalchemy import func as sql_func
 
 from litestar.contrib.repository import AbstractAsyncRepository, RepositoryError
@@ -711,12 +711,19 @@ async def check_health(cls, session: AsyncSession) -> bool:
             session: through which we run a check statement
 
         Returns:
-            `True` if healthy.
+            ``True`` if healthy.
         """
-        return (  # type:ignore[no-any-return]  # pragma: no cover
-            await session.execute(text("SELECT 1"))
+
+        return (  # type:ignore[no-any-return]
+            await session.execute(cls._get_health_check_statement(session))
         ).scalar_one() == 1
 
+    @staticmethod
+    def _get_health_check_statement(session: AsyncSession) -> TextClause:
+        if session.bind and session.bind.dialect.name == "oracle":
+            return text("SELECT 1 FROM DUAL")
+        return text("SELECT 1")
+
     async def _attach_to_session(self, model: ModelT, strategy: Literal["add", "merge"] = "add") -> ModelT:
         """Attach detached instance to the session.
 
diff --git a/litestar/contrib/sqlalchemy/repository/_sync.py b/litestar/contrib/sqlalchemy/repository/_sync.py
--- a/litestar/contrib/sqlalchemy/repository/_sync.py
+++ b/litestar/contrib/sqlalchemy/repository/_sync.py
@@ -4,7 +4,7 @@
 
 from typing import TYPE_CHECKING, Any, Generic, Iterable, Literal, cast
 
-from sqlalchemy import Result, Select, delete, over, select, text, update
+from sqlalchemy import Result, Select, TextClause, delete, over, select, text, update
 from sqlalchemy import func as sql_func
 
 from litestar.contrib.repository import AbstractSyncRepository, RepositoryError
@@ -713,12 +713,19 @@ def check_health(cls, session: Session) -> bool:
             session: through which we run a check statement
 
         Returns:
-            `True` if healthy.
+            ``True`` if healthy.
         """
-        return (  # type:ignore[no-any-return]  # pragma: no cover
-            session.execute(text("SELECT 1"))
+
+        return (  # type:ignore[no-any-return]
+            session.execute(cls._get_health_check_statement(session))
         ).scalar_one() == 1
 
+    @staticmethod
+    def _get_health_check_statement(session: Session) -> TextClause:
+        if session.bind and session.bind.dialect.name == "oracle":
+            return text("SELECT 1 FROM DUAL")
+        return text("SELECT 1")
+
     def _attach_to_session(self, model: ModelT, strategy: Literal["add", "merge"] = "add") -> ModelT:
         """Attach detached instance to the session.
 


Test patch:
diff --git a/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_bigint.py b/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_bigint.py
--- a/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_bigint.py
+++ b/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_bigint.py
@@ -559,3 +559,14 @@ async def test_lazy_load(item_repo: ItemAsyncRepository, tag_repo: TagAsyncRepos
     await maybe_async(item_repo.session.commit())
     assert len(updated_obj.tags) > 0
     assert updated_obj.tags[0].name == "A new tag"
+
+
+async def test_repo_health_check(author_repo: AuthorAsyncRepository) -> None:
+    """Test SQLALchemy health check.
+
+    Args:
+        author_repo (AuthorAsyncRepository): The mock repository
+    """
+
+    healthy = await maybe_async(author_repo.check_health(author_repo.session))
+    assert healthy
diff --git a/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_uuid.py b/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_uuid.py
--- a/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_uuid.py
+++ b/tests/unit/test_contrib/test_sqlalchemy/test_repository/test_repo_uuid.py
@@ -665,3 +665,14 @@ async def test_lazy_load(item_repo: ItemAsyncRepository, tag_repo: TagAsyncRepos
     await maybe_async(item_repo.session.commit())
     assert len(updated_obj.tags) > 0
     assert updated_obj.tags[0].name == "A new tag"
+
+
+async def test_repo_health_check(author_repo: AuthorAsyncRepository) -> None:
+    """Test SQLALchemy health check.
+
+    Args:
+        author_repo (AuthorAsyncRepository): The mock repository
+    """
+
+    healthy = await maybe_async(author_repo.check_health(author_repo.session))
+    assert healthy