{"id":19078783,"url":"https://github.com/elasticrash/spawnflake","last_synced_at":"2025-04-30T05:22:31.643Z","repository":{"id":43438733,"uuid":"363532920","full_name":"elasticrash/spawnflake","owner":"elasticrash","description":"Spawnflake is a schema agnostic, random and/or patterns based data generator, for MySQL databases.","archived":false,"fork":false,"pushed_at":"2024-04-03T10:25:13.000Z","size":172,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-12T10:15:38.691Z","etag":null,"topics":["database","database-testing","fake-data-generator","integration-testing"],"latest_commit_sha":null,"homepage":"https://discord.gg/khfC4NBcnX","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elasticrash.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-02T00:11:53.000Z","updated_at":"2024-09-13T22:20:42.000Z","dependencies_parsed_at":"2024-03-11T16:03:02.107Z","dependency_job_id":"ae216e1d-8616-4979-884b-abd11bd93a46","html_url":"https://github.com/elasticrash/spawnflake","commit_stats":{"total_commits":73,"total_committers":2,"mean_commits":36.5,"dds":0.1917808219178082,"last_synced_commit":"9a2281b14fcfb552c4c4e03e6a04bf68e38cf602"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticrash%2Fspawnflake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticrash%2Fspawnflake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticrash%2Fspawnflake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elasticrash%2Fspawnflake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elasticrash","download_url":"https://codeload.github.com/elasticrash/spawnflake/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251645988,"owners_count":21620848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","database-testing","fake-data-generator","integration-testing"],"created_at":"2024-11-09T02:11:57.162Z","updated_at":"2025-04-30T05:22:31.622Z","avatar_url":"https://github.com/elasticrash.png","language":"Rust","readme":"# ![a pixel fish](./assets/logo.png \"fish\") Spawnflake [![Rust](https://github.com/elasticrash/spawnflake/actions/workflows/rust.yml/badge.svg)](https://github.com/elasticrash/spawnflake/actions/workflows/rust.yml)\n\nSpawnflake is a schema agnostic, random and/or patterns based data generator, for MySQL databases.\n\n## what's new\nSee [CHANGELOG](CHANGELOG.md) for updates and new features.\n\n## usage\nThis library works by providing a configuration file (config.json). The configuration is divided into two sections.\n### connection properties (mandatory)\n```json \n \"mysql_configuration\": {\n        \"address\": \"localhost\",\n        \"port\": 3306,\n        \"user\": \"local\",\n        \"password\": \"password\",\n        \"schema\": \"test\"\n    }\n```\n### type patterns (optional)\n```json\n \"types\": {\n        \"string\": [\n            {\n                \"name\": \"column_name\",\n                \"rules\": []\n            }\n        ],\n        \"integer\": [\n            {\n                \"name\": \"column_name\",\n                \"rules\":[]\n            }\n        ],\n        \"float\": [\n            {\n                \"name\": \"column_name\",\n                \"rules\":[]\n            }\n        ]\n    }\n```\n### Rules\n* Rules for numeric types and dates just desired ranges (from, to). **Important!!** the small values need to be first in the lists. \n* Rules for strings are combinatinatory, you provide collections that are mixed and matched.\ni.e.\n\n```json\n   \"rules\": [\n                    [\n                        \"Jo\",\n                        \"Ni\",\n                        \"Ste\",\n                        \"Da\",\n                        \"Sco\",\n                        \"Ma\"\n                    ],\n                    [\n                        \"ve\",\n                        \"vi\",\n                        \"pha\",\n                        \"ro\",\n                        \"na\",\n                        \"ri\"\n                    ],\n                    [\n                        \"n\",\n                        \"ck\",\n                        \"tt\",\n                        \"d\",\n                        \"than\",\n                        \"na\"\n                    ]\n                ]\n```\nThis could create real names like `David` but also complete random combinations like `Jophack`\n\n## known limitations\n* When handling cyclic dependencies, keys are not currently updated retrospectively. This feature is planned for a future version\n* If a foreign key is unique, fewer records will be inserted into that table. Unique foreign key values are not supported yet.\n* In certain cases, number validation in the configuration is not performed, records assosiated with problematic tables cloud be \n  * skipped\n  * panic\n  * use default values\ndepending on a case by case basis.\n\n## support \n### Database support \n#### MySQL\n* supported data types and generators:\n\n| Datastore   | Data type                | Random    | Pattern      | \n| ----------- | -----------              |-----------| -----------  | \n| Mysql       | varchar                  | ✔️         | ✔️            |\n| Mysql       | int                      | ✔️         | ✔️            |\n| Mysql       | unsigned int             | ✔️         | ✔️            |\n| Mysql       | smallint                 | ✔️         | ✔️            |\n| Mysql       | unsigned smallint        | ✔️         | ✔️            |\n| Mysql       | tinyint/unsigned tinyint | ✔️         | ✔️            |\n| Mysql       | mediumint                | ✔️         | ✔️            |\n| Mysql       | bigint                   | ✔️         | ✔️            |\n| Mysql       | unsigned bigint          | ✔️         | ✔️            |\n| Mysql       | decimal                  | ✔️         | ✔️            |\n| Mysql       | float                    | ✔️         | ✔️            |\n| Mysql       | double                   | ✔️         | ✔️            |\n| Mysql       | bit                      | ✔️         | ❌           |\n| Mysql       | time                     | ✔️         | ✔️            |\n| Mysql       | timestamp                | ✔️         | ✔️            |\n| Mysql       | date                     | ✔️         | ✔️            |\n| Mysql       | year                     | ✔️         | ❌           |\n| Mysql       | char                     | ✔️         | ❌           |\n| Mysql       | binary                   | ✔️         | ❌           |\n| Mysql       | text                     | ✔️         | ❌           |\n| Mysql       | longtext                 | ✔️         | ❌           |\n| Mysql       | blob/longblob            | ✔️         | ❌           |\n| Mysql       | enum                     | ❌        | ✔️            |\n\n## CLI\nThe main project in this repository is a library, but there is also a [CLI version](https://crates.io/crates/spawnflake-cli) available published in crates.io.\nThe code for the CLI is available at `./cli`. Check [README](cli/readme.md) for usage and more information.\n\n## Running the example\nRunning the example requires running `docker-compose` inside the `test` folder. Make sure you have \n* Docker\n* An SQL client/ or a way to access the MySQL cli to view the generated records\n\nTo run the example execute\n\n```bash\ncargo run --example generate_mysql\n```\n\n## Contributing\n\nYou are more than welcome. All you need to do is a pull request\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felasticrash%2Fspawnflake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felasticrash%2Fspawnflake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felasticrash%2Fspawnflake/lists"}