Skip to main content

Fakeme

Data Generator for Chained and Relative Data

badge1 badge2 badge3 workflow

Documentation in process: https://fakeme.readthedocs.io/en/latest/

How to use

pip install fakeme

Check examples: https://github.com/xnuinside/fakeme/tree/master/examples

What 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.

Fakeme oriented on generation data that depend on values in another tables/datasets. Data, that knitted together as real.

Fakeme can 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_data table has field user_id and users table contains list of users with column id. You want join it on user_id = id.

Fakeme will 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:

  1. Add integration with simple-ddl-parser to generated data from different SQL dialects

  2. Add integration with py-models-parser to generated data from different Python models

  3. Fix cases in todo folder

  4. Improve test coverage

What you can to do

  1. Define that fields in your datasets must contain similar values

  2. You can set up how much values must intersect, for example, you want to emulate data for email validation pipeline - you have one dataset with incoming messages and you need to find all emails that was not added previously in your contacts table.

So you will have incoming messages table, that contains, for example only 70% of emails that exist in contacts table.

  1. You can use multiply columns as a key (dependency) in another column, for example, player_final_report must contains for each player same values as in other tables, for example, you have player table with players details and in_game_player_activity with all player activities for some test reasons it’s critical to you generate player_final_report with 1-to-1 data from other 2 tables.

  2. Union tables. You can generate tables that contains all rows from another tables.

  3. You can define your own generator for fields on Python.

  4. You can define your own output format

Examples

You can find usage examples in ‘fakeme/examples/’ folder.

Example from fakeme/examples/generate_data_related_to_existed_files:

from fakeme import Fakeme

# 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.json

cities_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 column

tables_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.json

Docs: https://fakeme.readthedocs.io/en/latest/

Changelog

v0.2.2

Fixes:

  1. generate_data_related_to_existed_files example now works well (generation data based on already existing files).

  2. Added integration tests to run examples

  3. Examples are cleaned up, unworking samples moved to ‘todo’

v0.2.1

  1. Now you can define tables as Table class object if it will be more easily for you.

from fakeme import Table

Table(name='table_name_example', schema='path/to/schema.json')

# or
user_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.py

  1. Relationships between tables was corrected

v0.1.0

  1. Added code changes to support Python 3.8 and upper (relative to changes in python multiprocessing module)

  2. Added tests runner on GitHub

  3. Autoaliasing was fixed

  4. Added some unit tests

Metadata

Release files for fakeme 0.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fakeme 0.2.2
File Size Uploaded Provenance
fakeme-0.2.2.tar.gz 26.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fakeme 0.2.2
File Interpreter ABI Platform
fakeme-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 52.7 kB

Release files / fakeme-0.2.2.tar.gz

Download URL fakeme-0.2.2.tar.gz
Size 26.2 kB
Tags Source
SHA-256 checksum
How to use checksums
050556a6700323cff373a4b07402b68963aa698331ff0fedf40b3590790c94e6
BLAKE2b-256 checksum
How to use checksums
9825ae90e49da19c12952a7f3e874869b0becef9946557b6ac46d5394a4e5d91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.11 Darwin/19.6.0

Release files / fakeme-0.2.2-py3-none-any.whl

Download URL fakeme-0.2.2-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6a41637633260a0c5ddedac5abdada4a6c7b65b79796beba9be98ed448043ff4
BLAKE2b-256 checksum
How to use checksums
fe6fb716b1112b90c90b123ae9e0eb78df05b93aa311dcd23201f69c9c670d7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.11 Darwin/19.6.0

Security for fakeme 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page