Skip to content

Add ability to export generated profiles to multiple formats (JSON, CSV, Excel) #66

@AnshMNSoni

Description

@AnshMNSoni

Is your feature request related to a problem? Please describe.

I'm always frustrated when I generate multiple random profiles for testing purposes (e.g., 100+ profiles for database seeding or API testing) and have no built-in way to save them to a file. Currently, I have to manually write my own export logic every time I need to persist the generated data, which leads to repetitive code and inconsistent formatting across different projects. This makes it difficult to:

  • Share generated test datasets with team members
  • Reuse the same test data across multiple test runs
  • Import profiles into databases or other systems
  • Create reproducible test scenarios with the same mock data

Describe the solution you'd like
I would like built-in export functionality that allows users to save generated profiles to common file formats directly from the library. The solution should include:

Export methods for popular formats:

  • JSON (for APIs and web applications)
  • CSV (for spreadsheets and data analysis)
  • Excel (for business reporting and sharing)

Simple API like:

pythonfrom random_profile import RandomProfile

# Generate profiles
profiles = [RandomProfile().generate() for _ in range(100)]

# Export to different formats
RandomProfile.export_to_json(profiles, 'test_profiles.json')
RandomProfile.export_to_csv(profiles, 'test_profiles.csv')
RandomProfile.export_to_excel(profiles, 'test_profiles.xlsx')

Describe alternatives you've considered

  • Manual export using standard libraries: Writing custom export functions using json, csv, and openpyxl libraries for each project. This works but requires repetitive boilerplate code and isn't user-friendly.
  • Third-party data export libraries: Using libraries like pandas to convert and export data. While powerful, this adds a heavy dependency just for simple export functionality.
  • Creating wrapper functions: Building a separate utility module that handles exports. This fragments the codebase and means maintaining export logic separately from profile generation.
  • Using pickle for serialization: While this saves Python objects, it's not human-readable or compatible with other tools/languages, limiting its usefulness for sharing or importing into databases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions