Package: fakeme
FakemeData Generator for Chained and Relative DataDocumentation in process:https://fakeme.readthedocs.io/en/latest/How to usepipinstallfakemeCheck examples:https://github.com/xnuinside/fakeme/tree/master/examplesWhat is Fakeme?Fakeme is a tools that try to understand your data based on schemas & fields name and generate data relative to expected.It create dependencies graph and generate relative data.Fakemeoriented on generation data that depend on values in another tables/datasets.
Data, that knitted together as real.Fakemecan help you if you want to generate several tables, that must contains in columns values,
that you will use like key for join.For example,user_datatable has fielduser_idanduserstable contains list of users with column id.
You want join it on user_id = id.Fakemewill generate for you 2 tables with same values in those 2 columns.It does not matter to have columns with same name you can define dependencies between tables with alias names.TODO in next releases:Add integration with simple-ddl-parser to generated data from different SQL dialectsAdd integration with py-models-parser to generated data from different Python modelsFix cases in todo folderImprove test coverageWhat you can to doDefine that fields in your datasets must contain similar valuesYou can set up how much values must intersect, for example, you want to emulate data for email validation pipeline -  you have one dataset withincomingmessages  and you need to find all emails that was not added previously in yourcontactstable.So you will have incoming messages table, that contains, for example only 70% of emails that exist in contacts table.You can use multiply columns as a key (dependency) in another column, for example,player_final_reportmust contains for each player same values as in other tables, for example, you haveplayertable
with players details andin_game_player_activitywith all player activities for some test reasons it’s critical
to you generateplayer_final_reportwith 1-to-1 data from other 2 tables.Union tables. You can generate tables that contains all rows from another tables.You can define your own generator for fields on Python.You can define your own output formatExamplesYou can find usage examples in ‘fakeme/examples/’ folder.Example from fakeme/examples/generate_data_related_to_existed_files:fromfakemeimportFakeme# to use some existed data you should provide with_data argument -# and put inside list with the paths to the file with data# data file must be in same format as .json or csv output of fakeme.# so it must be [{"column_name": value, "column_name2": value2 ..},#   {"column_name" : value, "column_name2": value2 ..}..]# Please check example in countries.jsoncities_schema=[{"name":"name"},{"name":"country_id"},{"name":"id"}]# all fields are strings - so I don't define type, because String will be used as default type for the columntables_list=[('cities',cities_schema)]Fakeme(tables=tables_list,with_data=['countries.json'],rls={'cities':{# this mean: for table 'cities''country_id':{# and column 'country_id' in table 'cities''table':'countries.json',# please take data from data  in countries.json'alias':'id',# with alias name 'id''matches':1# and I want all values in country_id must be from countries.id column, all.}}},settings={'row_numbers':1300}# we want to have several cities for each country,# so we need to have more rows,).run()# run and you will see a list of cities, that generated with same ids as in countries.jsonDocs:https://fakeme.readthedocs.io/en/latest/Changelogv0.2.2Fixes:generate_data_related_to_existed_files example now works well (generation data based on already existing files).Added integration tests to run examplesExamples are cleaned up, unworking samples moved to ‘todo’v0.2.1Now you can define tables as Table class object if it will be more easily for you.fromfakemeimportTableTable(name='table_name_example',schema='path/to/schema.json')# oruser_schema=[{'name':'id'},{'name':'title'},{'name':'rights','type':'list','alias':'right_id'},{'name':'description'}]Table(name='table_name_example',schema=user_schema)samples it tests: tests/unittests/test_core.pyRelationships between tables was correctedv0.1.0Added code changes to support Python 3.8 and upper (relative to changes in python multiprocessing module)Added tests runner on GitHubAutoaliasing was fixedAdded some unit tests