api: deprecate UserItem.CSVImport.validate_file_for_import in favor of a safer replacement
还没有人认领这个 Issue。
评估
调研方向
Locate UserItem.CSVImport and its validate_file_for_import entry point, then inspect the samples/ callers and the existing _redact_password_column flow. Add the structured replacement and adapt the old method with its deprecation warning, ensuring the samples use the new method. Done means callers receive structured errors without raw field values while the legacy return shape remains available.
由索引模型根据 Issue 内容生成。
描述
validate_file_for_import is public API and its current shape invited the class of bug that #1829 patched. Proposing an additive replacement plus a deprecation on the existing method - no breaking change now, removal on the next major version.
Current signature:
def validate_file_for_import(csv_file, logger) -> tuple[int, list[str]]
Two problems with the shape:
- Logger as a parameter made #1829 possible in the first place - a caller-supplied verbose logger could receive credential material. Prefer a module logger with documented levels.
- Returning raw invalid lines forces callers to re-parse to give a useful error, and hands credential-bearing rows back to the caller (mitigated by
_redact_password_columnbut the shape invites the bug).
Proposed replacement:
@dataclass(frozen=True)
class CsvImportError:
row: int
column: ColumnType | None
reason: str # never the raw field value
@dataclass
class CsvImportResult:
valid_count: int
errors: list[CsvImportError]
@staticmethod
def validate_import_file(csv_file) -> CsvImportResult: ...
Migration:
- Add
validate_import_filereturning the structured result. - Reimplement
validate_file_for_importas a thin wrapper that emitsDeprecationWarningand adapts back to the old return shape. - Update
samples/to use the new method. - Remove the deprecated method on the next major version bump.
🤖 Generated with Claude Code
- 主要语言
- Python
- 星标
- 716
- 派生
- 446
- 平均合并
- 8 天 8 小时
- 30 天内合并 PR
- 2
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
tableau/server-client-python 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
tableau/server-client-python#1865 ·
-
in-progress
难度 2/5 1-3 小时 新手友好度 78/100
tableau/server-client-python#1829 · 1 条评论 ·
-
enhancement gap needs investigation
难度 2/5 1-3 小时 新手友好度 68/100
tableau/server-client-python#1322 · 1 条评论 ·
-
[Type2] Allow Incremental Refresh type schedules to be added via `server.schedules.add_to_schedule` 未关闭help wanted Server-Side Enhancement ui-exists
难度 2/5 1-3 小时 新手友好度 68/100
tableau/server-client-python#1101 · 3 条评论 ·
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 68/100
tableau/server-client-python#783 · 5 条评论 ·
查看 tableau/server-client-python 的全部 Issue
相似的 Issue
-
bug ci good first issue
难度 2/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
documentation
难度 2/5 半天 新手友好度 62/100
inmanta/inmanta-core#10835 ·
-
sponsored
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 86/100
Diaoul/subliminal#1382 ·