Skip to content

sqlalchemy.exc.CompileError: Can't generate DDL for NullType(); did you forget to specify a type on this Column? #1520

Discussion options

You must be logged in to vote

You need to specify column type for SQLAlchemy:

    semantic_search_result: List[SemanticSearchDict] = Field(sa_type=ARRAY(JSON))

Runnable code example in the details:

from typing import List, Optional

from sqlalchemy_utils.functions import create_database, database_exists
from sqlmodel import ARRAY, JSON, Field, Session, SQLModel, create_engine
from typing_extensions import TypedDict


class InnerSemanticSearchDict(TypedDict):
    acquis_code: str
    ...


class SemanticSearchDict(TypedDict):
    rank: int
    value: InnerSemanticSearchDict


class SemanticSearch(SQLModel, table=True):
    id: Optional[int] = Field(default=None, primary_key=True)
    ...
    semantic_search_result: List[

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by YuriiMotov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
3 participants
Converted from issue

This discussion was converted from issue #69 on August 14, 2025 21:21.