Skip to content
Closed
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
6 changes: 5 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ ignore_errors = true
qt_api = "pyside6"

[tool.pyright]
ignore = ["src/tagstudio/qt/helpers/vendored/pydub/", ".venv/**"]
ignore = [
".venv/**",
"src/tagstudio/core/library/json/",
"src/tagstudio/qt/helpers/vendored/pydub/",
]
include = ["src/tagstudio", "tests"]
reportAny = false
reportIgnoreCommentWithoutRule = false
Expand Down
11 changes: 11 additions & 0 deletions src/tagstudio/core/library/alchemy/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@
)
SELECT * FROM ChildTags;
""")

TAG_CHILDREN_ID_QUERY = text("""
WITH RECURSIVE ChildTags AS (
SELECT :tag_id AS tag_id
UNION
SELECT tp.child_id AS tag_id
FROM tag_parents tp
INNER JOIN ChildTags c ON tp.parent_id = c.tag_id
)
SELECT tag_id FROM ChildTags;
""")
7 changes: 5 additions & 2 deletions src/tagstudio/core/library/alchemy/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@


from pathlib import Path
from typing import override

import structlog
from sqlalchemy import Dialect, Engine, String, TypeDecorator, create_engine, text
Expand All @@ -19,12 +20,14 @@ class PathType(TypeDecorator):
impl = String
cache_ok = True

def process_bind_param(self, value: Path, dialect: Dialect):
@override
def process_bind_param(self, value: Path | None, dialect: Dialect):
if value is not None:
return Path(value).as_posix()
return None

def process_result_value(self, value: str, dialect: Dialect):
@override
def process_result_value(self, value: str | None, dialect: Dialect):
if value is not None:
return Path(value)
return None
Expand Down
Loading