v0.1.0

Exports and test data

Write data and schema files from export profiles, with subsets, masking and synthetic rows.

An export profile exports/<name>.toml says what to write. It holds no credentials: connection names a connection profile, and output defaults to out/exports/<name>.

databee export list
databee export check test-data
databee export test-data

What a profile can write

[[data]] entries write rows of entities (public.customer, public.*, *) as csv, ndjson, sql-insert or sql-copy (PostgreSQL only). [[schema]] entries write artifacts derived from the model: ddl, dbml, json-schema, dictionary, diagram. A JSON Schema for profiles is in .databee/schemas/export.schema.json.

Rows are streamed from one consistent read-only transaction. Two runs on unchanged data write identical files and an identical manifest.json, which lists a SHA-256 per file and no timestamp. SQL exports are ordered parents first and end with setval for identity and owned sequences. databee init puts out/ into the project’s .gitignore, because data exports can hold personal data.

Subsets

where (a SQL predicate), sample ({ rows = N } or { percent = P, seed = S }) and include_children on a [[data]] entry choose the rows of a root table. The rows they reference are always exported, so every key in the export resolves. The manifest lists the subset per entity.

Masking

[[data]]
entities = ["shop.customer"]
format = "ndjson"

[data.mask]
email = { fake = "email" }

Strategies: hash, fake (email, name, phone, iban, text and more), null, constant, shift_date, round, keep_format. Output keeps type and length, keys stay unique, and columns that reference a masked key follow it. The secret is the environment variable DATABEE_MASK_KEY, never written to a file; without it a run uses a random key and says so.

Mark personal fields with sensitive. export check then warns (DB-EXP-015) when one is exported without a mask, and --strict stops before writing. Masking replaces values, but it is not a privacy guarantee for small or unusual data.

Synthetic test data

No database needed:

databee generate data --rows 20 --seed 1 --format sql-insert

It writes --rows rows for every entity (default 10) to out/generated, in load order. Foreign keys point only to generated parent rows, primary and unique keys hold, and enums and simple checks (x > 0, ranges, BETWEEN, IN lists) are respected. The same model, seed and options always give the same bytes. A check it does not understand is reported (DB-EXP-024) and the values are generated without it, so load the data to see whether it passes.

For control per table, a generating profile uses generate = { rows = 20, seed = 1 } or generate = { per_parent = "1..5" } on a [[data]] entry, with [data.columns] rules per column (fake, constant, values, min/max, null_share):

[[data]]
entities = ["shop.*"]
generate = { rows = 20, seed = 1 }
format = "sql-insert"

[[schema]]
kind = "ddl"

Run it with databee generate data --profile <name> or databee export <name>. MongoDB collections can be exported only as ndjson, and masks, subsets and generation are refused for them (DB-EXP-001).

Edit this page on GitHub · Docs for v0.1.0