{"library":"snowfakery","title":"Snowfakery","type":"library","description":"Snowfakery is a Python tool for generating fake data models with relational integrity. It allows users to define complex data structures, including relationships between 'tables' (objects), using YAML configuration. Each generated record is unique and random. Currently at version 4.2.1, it maintains an active development pace with frequent minor releases and occasional major updates addressing Python compatibility and core feature enhancements.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install snowfakery"],"cli":{"name":"snowfakery","version":"snowfakery version 4.2.1"}},"imports":["from snowfakery.api import generate_data"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":"https://snowfakery.readthedocs.io","github":"https://github.com/SFDO-Tooling/Snowfakery","docs":null,"changelog":null,"pypi":"https://pypi.org/project/snowfakery/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"import io\nfrom snowfakery.api import generate_data\n\n# Define a simple Snowfakery data model in YAML\ndata_model_yaml = \"\"\"\n- object: Contact\n  count: 2\n  fields:\n    FirstName:\n      random_first_name: {}\n    LastName:\n      random_last_name: {}\n    Email:\n      formula: f\"{FirstName}.{LastName}@example.com\"\n\"\"\"\n\n# Use io.StringIO to simulate file input and output for a quick example\ninput_stream = io.StringIO(data_model_yaml)\noutput_stream = io.StringIO()\n\n# Generate data\ngenerate_data(\n    yaml_file=input_stream,\n    output_format=\"json\", # or \"csv\", \"sqlite\", \"sql\", \"db\"\n    output_file=output_stream\n)\n\n# Print the generated JSON data\nprint(output_stream.getvalue())","lang":"python","description":"This quickstart demonstrates how to programmatically use Snowfakery to generate JSON data based on a YAML data model. It uses `io.StringIO` to avoid creating temporary files, making it suitable for in-memory execution.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}