Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add bulk_add_from_file(filepath, strict=False) as file-based user import successor to deprecated create_from_file

Đang mở
#1,836 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
58/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

Start by reading users.bulk_add, the deprecated create_from_file, and UserItem.CSVImport.validate_file_for_import to understand the existing import flow and POST /users/import integration. Confirm the behavior for strict and non-strict validation, including the JobItem and SkippedLine results, and consider how tabcmd issue #1809 would use the method.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Summary

Add users.bulk_add_from_file(filepath, strict=False) -> tuple[JobItem, list[SkippedLine]] as the modern file-based user import convenience. The existing users.create_from_file is deprecated (v0.41.0) in favor of bulk_add, but bulk_add takes Iterable[UserItem] and has no file-reading equivalent. Callers who want "read this CSV, import users, tell me what happened" today have to hand-roll validation + iteration + error accumulation.

Proposed shape

def bulk_add_from_file(
    self,
    filepath: str,
    strict: bool = False,
) -> tuple[JobItem, list[SkippedLine]]:
    """
    Import users from a CSV file.

    - Reads the file
    - Validates each line via UserItem.CSVImport.validate_file_for_import
    - If strict=True: raises ValueError on the first invalid line
    - If strict=False: skips invalid lines, returns them in the second tuple element
    - Calls POST /users/import (via bulk_add) with the valid users
    - Returns the JobItem plus any client-side-rejected lines
    """

SkippedLine would be a small dataclass carrying the raw line, line number, and validation error.

Motivation

  • tabcmd (createsiteusers, createusers, addusers, etc.) currently duplicates ~100 lines of CSV parsing and validation logic client-side because there's no TSC method that spans file → server. #1809 tracks bringing tabcmd onto the shared TSC implementation; this method is what tabcmd would call.
  • Direct TSC users get the same convenience.
  • strict mode gives callers the choice between fail-fast and gather-errors, matching tabcmd's existing --complete / --no-complete CLI flag.
Ngôn ngữ chính
Python
Star
716
Fork
446
Merge trung bình
8 ngày 8 giờ
Pull request đã merge (30 ngày)
2

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của tableau/server-client-python

Tất cả issue của tableau/server-client-python

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.