{"id":18015568,"url":"https://github.com/nomemory/pysert","last_synced_at":"2025-04-04T15:17:29.948Z","repository":{"id":82269839,"uuid":"328465577","full_name":"nomemory/pysert","owner":"nomemory","description":"A python script that can be used to generate arbitrarily data. Initially written the script around 2012, found it in the google code archives.","archived":false,"fork":false,"pushed_at":"2021-01-15T21:10:53.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-10T00:48:37.369Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nomemory.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-01-10T19:46:48.000Z","updated_at":"2022-01-15T21:32:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe2d27ef-16e9-47a2-aba7-5e3d7463a1c9","html_url":"https://github.com/nomemory/pysert","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/nomemory%2Fpysert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fpysert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fpysert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nomemory%2Fpysert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nomemory","download_url":"https://codeload.github.com/nomemory/pysert/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247198473,"owners_count":20900082,"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":[],"created_at":"2024-10-30T04:14:25.632Z","updated_at":"2025-04-04T15:17:29.916Z","avatar_url":"https://github.com/nomemory.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pysert\n\nA python script that can be used to generate arbitrary formatted data.\n\nFor a more complex solution, please check www.mockneat.com - a Java library that does exactly what this script does, and much more.\n\n_(Note: Script I've written in 2012, found it in the google code archives)._\n\n# Using the script\n\nTo be used with `python3`:\n\n```python\npython3 pysert.py -i tmpl.xml -o out.txt\n```\n\n`tmpl.xml` is the template based on which the script will generate the data:\n\n```xml\n\u003cpysert iterations=\"20\"\u003e\n\t\u003c!--  Declarative area --\u003e\n\t\u003cdataset name=\"id\" type=\"Sequence\" start=\"300\" increment=\"1\"/\u003e\n\t\u003cdataset name=\"fname\" type=\"PersonalName\" firstname=\"True\" lastname=\"False\"/\u003e\n\t\u003cdataset name=\"lname\" type=\"PersonalName\" firstname=\"False\" lastname=\"True\"/\u003e\n\t\u003cdataset name=\"jobid\" type=\"RandomNumber\" floating=\"False\" min=\"100\" max=\"200\"/\u003e\n\t\u003cdataset name=\"salary\" type=\"RandomNumber\" floating=\"False\" min=\"1000\" max=\"15000\"/\u003e\n\t\u003c!--  Actual template to be converted --\u003e\n\t\u003ctemplate\u003e\nINSERT INTO EMPLOYEES\n\t(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, JOB_ID, SALARY)\nVALUES\n\t(#{id}, '#{fname}', '#{lname}', '#{fname}_#{lname}@domain.com', #{jobid},\n\t#{salary})\n\t\u003c/template\u003e\n \u003c/pysert\u003e\n```\n\nAfter running the above command, a fille called `out.txt` will be generated.\nThe contents of the file are actual SQL Inserts:\n\n```SQL\nINSERT INTO EMPLOYEES\n\t(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, JOB_ID, SALARY)\nVALUES\n\t(300, 'Paula', 'Chehachkov', 'Paula_Chehachkov@domain.com', 175,\n\t8439)\n\n\nINSERT INTO EMPLOYEES\n\t(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, JOB_ID, SALARY)\nVALUES\n\t(301, 'Gabriel', 'Vlas', 'Gabriel_Vlas@domain.com', 183,\n\t11362)\n\n\nINSERT INTO EMPLOYEES\n\t(EMPLOYEE_ID, FIRST_NAME, LAST_NAME, EMAIL, JOB_ID, SALARY)\nVALUES\n\t(302, 'Mia', 'Fugger', 'Mia_Fugger@domain.com', 181,\n\t2080)\n\n// (... and so on)  \n```\n\n# Supported datasets\n\nThe supported datasets you can use are:\n\n* `RandomNumber`:\n  - `\"name\"`: `\u003cstring value\u003e`\n  - `\"floating\"` : `\"\u003cboolean value\u003e\"`\n  - `\"min\"`: `\"\u003cinteger value\u003e\"`\n  - `\"max\"`: `\"\u003cinteger value\u003e\"`\n* `LoremIpsum`:\n  - `\"name\"` : `\u003cstring value\u003e`\n  - `\"length\"` : `\"\u003cinteger value\u003e\"`\n* `PersonalName`:\n  - `\"name\"` : `\u003cstring value\u003e`\n  - `\"firstname\"` : `\"\u003cboolean value\u003e\"`\n  - `\"lastname\"` : `\"\u003cboolean value\u003e\"`\n* `Sequence` :\n  - `\"name\"` : `\u003cstring value\u003e`\n  - `\"start\"` : `\"\u003cinteger value\u003e\"`\n  - `\"increment\"` : `\"\u003cinteger value\u003e\"`\n\n# Adding your own data set:\n\nAll you have to do is to:\n1. Extend the class `AbstractDataSet`\n2. Override the method `def validation_list(self):` by including the properties of the DataSet - script will validate the input `xml` based on that.\n3. Overtide the method `def next_value(self):`. Here you define the \"arbitrary\" / \"random\" behavior of the data set.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomemory%2Fpysert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnomemory%2Fpysert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnomemory%2Fpysert/lists"}