{"id":13625333,"url":"https://github.com/Tinram/Database-Filler","last_synced_at":"2025-04-16T06:32:23.167Z","repository":{"id":24594885,"uuid":"28003230","full_name":"Tinram/Database-Filler","owner":"Tinram","description":"MySQL/MariaDB: populate database tables and test schema design by parsing the SQL schema file.","archived":true,"fork":false,"pushed_at":"2022-01-21T21:08:35.000Z","size":68,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-08-01T22:04:56.323Z","etag":null,"topics":["database-schema","database-testing","mariadb","mysql","mysql-schema","mysql-test","schema","schemas"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tinram.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-14T18:17:49.000Z","updated_at":"2023-01-28T03:48:28.000Z","dependencies_parsed_at":"2022-08-20T03:21:07.198Z","dependency_job_id":null,"html_url":"https://github.com/Tinram/Database-Filler","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinram%2FDatabase-Filler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinram%2FDatabase-Filler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinram%2FDatabase-Filler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tinram%2FDatabase-Filler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tinram","download_url":"https://codeload.github.com/Tinram/Database-Filler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223700377,"owners_count":17188306,"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-schema","database-testing","mariadb","mysql","mysql-schema","mysql-test","schema","schemas"],"created_at":"2024-08-01T21:01:54.104Z","updated_at":"2024-11-08T14:31:08.409Z","avatar_url":"https://github.com/Tinram.png","language":"PHP","funding_links":[],"categories":["mysql"],"sub_categories":[],"readme":"\n##### This repo is shoved into retirement. The schema file parsing and single-threaded nature of PHP, along with high memory usage makes this package obsolete.\n\n##### More efficient alternatives are [MySQL-Filler](https://github.com/Tinram/MySQL-Filler) and [mysql_random_data_load](https://github.com/Percona-Lab/mysql_random_data_load).\n\n\n\u003cbr\u003e\n\n\u003chr\u003e\n\n\u003cbr\u003e\n\n\n# Database Filler\n\n#### Populate MySQL database tables with test data by parsing the SQL schema file.\n\n\n## Purpose\n\n+ Database table population without using any real or sensitive data:\n+ Schema design and development:\n    + Check table field population with specified datatypes, potential data truncation etc.\n    + Test connection encoding and character encoding, and data insertion speeds.\n\n\u003cbr\u003e\n\n[1]: https://tinram.github.io/images/databasefiller-data.png\n![Database-Filler database][1]\n\n\u003cbr\u003e\n\n\n## Background\n\nOriginally, I needed to populate a database containing 14 complex tables. Tools such as Spawner are ideal for populating small tables, but in this case, specifying the datatypes for 300+ fields to initiate Spawner would have been insanity.\n\nInstead, why not parse the SQL schema?\n\n\n[2]: https://tinram.github.io/images/databasefiller-execute.png\n![Database-Filler execute][2]\n\n\n## Database Requirements\n\n1. The script expects the database schema to already exist in MySQL (`mysql -u root -p \u003c test.sql`).\n2. **All table names** and **column names** in the MySQL schema **require back-ticks**.\n3. **Unique keys must be removed** from tables when the configuration array option *random_data* is set to false.\n\n\n## Other\n\n+ The majority of MySQL datatypes are supported.\n+ Any foreign keys are disabled on data population.\n+ Random character generation is slow in PHP, and such slowness further depends on field length, number of fields, and the number of rows being generated.\n+ Multiple INSERTs are added in a single query, which is quite fast. The number of INSERTs per second will depend on MySQL configuration settings (the defaults are not optimised), datatype / length inserted, system load, operating system, hardware etc.\n\n\n## Further Options\n\nConfiguration boolean toggles (`false` by default):\n\n+ *incremental_ints*\n    + make added integers incremental, enabling simplistic integer foreign keys.\n+ *populate_primary_key*\n    + populate a primary key field, e.g. a UUID used as a primary key (experimental, supports only some definitions).\n\n\n## Set-up\n\nEnsure the database already exists in MySQL  \ne.g. for the test schema:\n\n```bash\n    mysql -u root -p \u003c test.sql\n```\n\nAdjust the array connection details and parameters in the file *databasefiller_example.php*\n\nThen execute this file with PHP on the command-line:\n\n```bash\n    php databasefiller_example.php\n```\n\n*or* run the file through a web server e.g.\n\n        http://localhost/Database-Filler/databasefiller_example.php\n\n\n## Other Projects\n\n+ [SQLParser](https://github.com/iamcal/SQLParser)\n+ [schema-parser-mysql](https://github.com/ekhaled/schema-parser-mysql/)\n+ [MySQL_Filler](https://github.com/Tinram/MySQL_Filler)\n\n*SQLParser* would have been used in this project had it been available in 2014.\n\n\n## License\n\nDatabase Filler is released under the [GPL v.3](https://www.gnu.org/licenses/gpl-3.0.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTinram%2FDatabase-Filler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTinram%2FDatabase-Filler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTinram%2FDatabase-Filler/lists"}