Repository: litestar-org/litestar

Issue:
Partial[DTO] Exception: typing.ClassVar[bool] is not valid as type argument
**Describe the bug**
When creating a `Partial[DTO]`, I get the following exception: `Exception: typing.ClassVar[bool] is not valid as type argument`

The exception appears to be thrown in the `partials.py` file, from the 3rd line copied here:

```
if item not in cls._models:
    if is_class_and_subclass(item, BaseModel):
        cls._create_partial_pydantic_model(item=item)
```

**To Reproduce**
Here's a minimal example to reproduce.  I'm using Python 3.10.6.

```
from sqlalchemy import Column
from sqlalchemy.dialects.postgresql import (
    INTEGER,
    JSONB,
    TIMESTAMP,
)
from sqlalchemy.orm import declarative_base
from starlite import DTOFactory
from starlite.plugins.sql_alchemy import SQLAlchemyPlugin
from starlite.types.partial import Partial

Base = declarative_base()
dto_factory = DTOFactory(plugins=[SQLAlchemyPlugin()])

class DTO_ORM(Base):
    __tablename__ = "some_table"

    id = Column(INTEGER, primary_key=True)
    value = Column(JSONB)
    logs = Column(JSONB)
    timestamp = Column(TIMESTAMP)

DTO_MODEL = dto_factory("DTO_MODEL", DTO_ORM)

partial_dto = Partial[DTO_MODEL]
data = {"id": 789}
partial_dto(**data)
```

**Additional context**
I believe I've implemented this code correctly, but there aren't a lot of examples for how to use DTOs or Partials, so please let me know if something is wrong with the code. 

Docs: https://starlite-api.github.io/starlite/usage/11-data-transfer-objects/#partial-dtos


Discussion:
I just played with the code in the tests folder... it seems like this exception does not occur using DTO's created Pydantic models.  So maybe it's isolated to DTO's created by SQL Alchemy/ORM models. 

**This works:**
```
import json
from dataclasses import dataclass as vanilla_dataclass
from enum import Enum
from typing import Any, Dict, List, Optional

import pytest
from pydantic import BaseModel, Field
from pydantic.dataclasses import dataclass as pydantic_dataclass
from pydantic_factories import ModelFactory
from starlette.status import HTTP_201_CREATED
from starlite import DTOFactory, post
from starlite.plugins.sql_alchemy import SQLAlchemyPlugin
from starlite.testing import create_test_client
from starlite.types.partial import Partial
from typing_extensions import TypedDict

# from tests import Person, TypedDictPerson, VanillaDataClassPerson
# from tests.plugins.sql_alchemy_plugin import Pet, WildAnimal


# Base = declarative_base()
dto_factory = DTOFactory(plugins=[SQLAlchemyPlugin()])

class Person(BaseModel):
    first_name: str
    last_name: str
    id: str
    optional: Optional[str]
    complex: Dict[str, List[Dict[str, str]]]
    pets: Optional[List[Pet]] = None

dto_person = dto_factory("dto_person", Person)
dto_partial_person = Partial[Person]
dto_partial_person(first_name="Bob")
```

**Returns:**
```
PartialPerson(first_name='Bob', last_name=None, id=None, optional=None, complex=None, pets=None)
```

Resolving patch:
diff --git a/starlite/types/partial.py b/starlite/types/partial.py
--- a/starlite/types/partial.py
+++ b/starlite/types/partial.py
@@ -15,6 +15,7 @@
 )
 
 from pydantic import BaseModel, create_model
+from pydantic.typing import is_classvar
 from typing_extensions import TypedDict, get_args
 
 from starlite.exceptions import ImproperlyConfiguredException
@@ -88,6 +89,8 @@ def _create_partial_pydantic_model(cls, item: Type[BaseModel]) -> None:
         """
         field_definitions: Dict[str, Tuple[Any, None]] = {}
         for field_name, field_type in get_type_hints(item).items():
+            if is_classvar(field_type):
+                continue
             if not isinstance(field_type, GenericAlias) or NoneType not in field_type.__args__:
                 field_definitions[field_name] = (Optional[field_type], None)
             else:


Test patch:
diff --git a/tests/__init__.py b/tests/__init__.py
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -5,8 +5,13 @@
 from pydantic import BaseModel, Field
 from pydantic.dataclasses import dataclass as pydantic_dataclass
 from pydantic_factories import ModelFactory
+from sqlalchemy import Column
+from sqlalchemy.dialects.postgresql import INTEGER, JSONB, TEXT
+from sqlalchemy.orm import declarative_base
 from typing_extensions import TypedDict
 
+Base = declarative_base()
+
 
 class Species(str, Enum):
     DOG = "Dog"
@@ -65,3 +70,14 @@ class TypedDictPerson(TypedDict):
     optional: Optional[str]
     complex: Dict[str, List[Dict[str, str]]]
     pets: Optional[List[Pet]]
+
+
+class Car(Base):
+    __tablename__ = "db_cars"
+
+    id = Column(INTEGER, primary_key=True)
+    year = Column(INTEGER)
+    make = Column(TEXT)
+    model = Column(TEXT)
+    horsepower = Column(INTEGER)
+    color_codes = Column(JSONB)
diff --git a/tests/dto_factory/test_dto_factory_partials.py b/tests/dto_factory/test_dto_factory_partials.py
new file mode 100644
--- /dev/null
+++ b/tests/dto_factory/test_dto_factory_partials.py
@@ -0,0 +1,45 @@
+from starlite import DTOFactory
+from starlite.plugins.sql_alchemy import SQLAlchemyPlugin
+from starlite.types.partial import Partial
+from tests import Car, Person
+
+dto_factory = DTOFactory(plugins=[SQLAlchemyPlugin()])
+
+
+def test_partial_dto_pydantic() -> None:
+    dto_partial_person = Partial[Person]
+    bob = dto_partial_person(first_name="Bob")  # type: ignore
+    assert bob.first_name == "Bob"  # type: ignore
+
+
+def test_partial_dto_sqlalchemy_model() -> None:
+    car_one = {
+        "id": 1,
+        "year": 2022,
+        "make": "Ferrari",
+        "model": "488 Challenge Evo",
+        "horsepower": 670,
+        "color_codes": {
+            "red": "Rosso corsa",
+            "black": "Nero",
+            "yellow": "Giallo Modena",
+        },
+    }
+
+    car_two = {
+        "id": 2,
+        "year": 1969,
+        "make": "Ford",
+        "model": "GT40",
+        "horsepower": 380,
+    }
+
+    # Test for non-partial DTO
+    dto_car = dto_factory("dto_cars", Car)
+    ferrari = dto_car(**car_one)
+    assert ferrari.year == 2022  # type: ignore
+
+    # Test for partial DTO
+    partial_dto_car = Partial[dto_car]  # type: ignore
+    ford = partial_dto_car(**car_two)
+    assert ford.make == "Ford"  # type: ignore