lint: log the skipped album source-id lookup instead of a bare try/except/pass (ruff S110)
The Deezer missing-column fallthrough in find_existing_soulsync_album_id used a bare 'except: pass', which ruff flags as S110. Log it at debug instead — same fail-safe behaviour, no swallowed-exception lint warning.
This commit is contained in:
parent
820ff20139
commit
2ecbd8badc
1 changed files with 6 additions and 2 deletions
|
|
@ -25,6 +25,10 @@ from __future__ import annotations
|
||||||
|
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
|
||||||
|
from utils.logging_config import get_logger
|
||||||
|
|
||||||
|
logger = get_logger("imports.album_grouping")
|
||||||
|
|
||||||
# Album source-id columns this grouping may key on. An allowlist (not arbitrary
|
# Album source-id columns this grouping may key on. An allowlist (not arbitrary
|
||||||
# interpolation) — the column name IS spliced into SQL, so it must be a known,
|
# interpolation) — the column name IS spliced into SQL, so it must be a known,
|
||||||
# trusted identifier. Mirrors get_library_source_id_columns()' 'album' values.
|
# trusted identifier. Mirrors get_library_source_id_columns()' 'album' values.
|
||||||
|
|
@ -78,12 +82,12 @@ def find_existing_soulsync_album_id(
|
||||||
row = cursor.fetchone()
|
row = cursor.fetchone()
|
||||||
if row:
|
if row:
|
||||||
return row[0]
|
return row[0]
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
# That source has no dedicated album column on this DB (e.g. Deezer
|
# That source has no dedicated album column on this DB (e.g. Deezer
|
||||||
# doesn't split per-entity id columns) — fall through to the name
|
# doesn't split per-entity id columns) — fall through to the name
|
||||||
# match rather than break the import. Mirrors the guarded source-id
|
# match rather than break the import. Mirrors the guarded source-id
|
||||||
# UPDATE the caller already does on insert.
|
# UPDATE the caller already does on insert.
|
||||||
pass
|
logger.debug("album source-id lookup skipped (%s): %s", album_source_col, exc)
|
||||||
|
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"SELECT id FROM albums WHERE title COLLATE NOCASE = ? AND artist_id = ? "
|
"SELECT id FROM albums WHERE title COLLATE NOCASE = ? AND artist_id = ? "
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue