Table Schema Faker
Generate tabular fake data conforming to a Table Schema.
tsfaker library is available on PyPI.
This library was originally developed to generate a synthetic version of SNDS database, which contains hundreds of tables, hence tsfaker efficiently deals with foreign keys.
Notes :
We aim to generate fake data conforming to a schema, not fake data with realistic statistical information (see Related work section).
This library is in beta and subject to frequent changes (see Releases notes section).
Usage
Installation
$ pip3 install tsfaker
Simple usage
Generate 3 rows of fake data from a single table schema file.
$ tsfaker https://gitlab.com/healthdatahub/tsfaker/raw/master/tests/schemas/implemented_types.json --nrows 3 --pretty
boolean string number integer date datetime year yearmonth
0 1 haHoKysholbSI 9780230269.512 -7061309068 1914-10-03 1902-04-11T11:21:11Z 1939 196405
1 0 rLugGhNek 990894536.8945 2529879443 2026-09-08 2015-11-27T16:21:54Z 1932 192909
2 1 ipqVXm -4371053960.8987 -529880373 1994-09-27 1937-01-12T18:40:15Z 2021 193303
Advanced usage
Show help message.
$ tsfaker --help
Usage: tsfaker [OPTIONS] [SCHEMA_DESCRIPTORS]...
...
Download examples schemas from project schema-snds.
$ git clone https://gitlab.com/healthdatahub/schema-snds && cd schema-snds
Generate fake data for all schemas in a schemas folder using csv files in nomenclatures folder, and write them to fake_data folder.
$ mkdir fake_data
$ tsfaker schemas -o fake_data -r nomenclatures
2019-01-01 00:00:00 :: INFO :: Data generated from descriptor 'schemas/PMSI/PMSI MCO/T_MCOaa_nnE.json' will be written on 'fake_data/PMSI/PMSI MCO/T_MCOaa_nnE.csv'
2019-01-01 00:00:00 :: INFO :: Data generated from descriptor 'schemas/PMSI/PMSI MCO/T_MCOaa_nnFASTC.json' will be written on 'fake_data/PMSI/PMSI MCO/T_MCOaa_nnFASTC.csv'
2019-01-01 00:00:00 :: INFO :: Data generated from descriptor 'schemas/PMSI/PMSI SSR/T_SSRaa_nnE.json' will be written on 'fake_data/PMSI/PMSI SSR/T_SSRaa_nnE.csv'
...
Release notes
Version 0.14
[Fix] Update command line default value to match Click library version >=8.0
Version 0.13
[Fix] Adapt maximum default integer value to local system
Version 0.12
It is possible to specify trueValues and falseValues for boolean type (according to TableSchema standard)
Only one item is accepted in trueValues and falseValues arrays
It is possible to specify a format for types date and datetime
Version 0.11
yearmonth type does not follow ISO 8601 format ‘YYYY-MM’ and is now generated without a dash ‘YYYYMM’
Version 0.10
boolean type is implemented, default values for this type are 0 for False and 1 for True
Metadata
Release files for tsfaker 0.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tsfaker-0.14.tar.gz | 16.5 kB | Without provenance | Details for tsfaker-0.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tsfaker-0.14-py3-none-any.whl | Python 3 | none | any | Details for tsfaker-0.14-py3-none-any.whl |
Total release size: 38.8 kB
Release files / tsfaker-0.14.tar.gz
| Download URL | tsfaker-0.14.tar.gz |
|---|---|
| Size | 16.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
056ecef7c0888532b9df02e5afdaf802781bad6afca6b85bcf11d18f9e578e28
|
|
BLAKE2b-256 checksum How to use checksums |
62b59d5daddb08a88ca5b9572360e5350581aad73aec0ecc874a275c5bdaa3dc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
|
Release files / tsfaker-0.14-py3-none-any.whl
| Download URL | tsfaker-0.14-py3-none-any.whl |
|---|---|
| Size | 22.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a083a4820c46cd408302aa62c1f22fc098c16929cb07f0e96c93706184577d0d
|
|
BLAKE2b-256 checksum How to use checksums |
0b0550d57b90578d2dd65af2a7c0df6270abd1820ac3660cfeb9c01892d143de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
|
Security for tsfaker 0.14
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.