Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/tidewave/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def __call__(self, environ: dict[str, Any], start_response: Callable):
else:
full_path = path_info

full_path = full_path.rstrip("/")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of FastAPI the full path is /tidewave/ at this point.


if full_path.startswith("/tidewave"):
security_error = self._check_security(environ)
if security_error:
Expand Down
8 changes: 6 additions & 2 deletions src/tidewave/sqlalchemy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ def get_models() -> str:
if model is base_class:
continue

# Check if it's an abstract model (has __abstract__ = True)
if getattr(model, "__abstract__", False):
# Check if it's an abstract model (has __abstract__ = True).
# Note that we check the dict instead of using getattr,
# so that we check the attribute on the specific model,
# otherwise we may access the attribute inherited from
# parent.
if model.__dict__.get("__abstract__", False):
Copy link
Contributor Author

@jonatanklosko jonatanklosko Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FastAPI uses sqlmodel, which is built on top of sqlalchemy. Models inherit from SQLModel, for example Hero(SQLModel). SQLModel has __abstract__ = True, and accessing it on Hero also returns True, because it's inherited. Checking the dict works as expected (since it doesn't include inherited attributes).

continue

# Check if it has any columns (indicating it's a concrete model)
Expand Down