Data model
The Fabricate API references the following data model.
Database attributes
Each database object can contain the following attributes:
id
The UUID of the database
name
The name of the database
created_at
The date and time the database was created.
updated_at
The date and time the database was last updated.
last_generated
The date and time the data was last generated.
data_url
After data is generated, download it from this URL.
platform
The type of the target database.
variables
The default variable values assigned to the database.
entities
workspace
The workspace that the database belongs to. Determined by the workspace name in the request path. You do not provide this when you create or update a database.
Entity (table) attributes
An entity is equivalent to a database table.
Each entity object can contain the following attributes:
name
The name of the entity.
records
Use exact
to generate an exact number of rows.
Use unique
to generate one row for each unique value of a field in this entity.
unique_records_for
Only applies when records
is set to unique
.
The name of the field that determines the number of unique rows to generate for this entity.
record_count
An expression that evaluates to the number of rows to generate for this entity. Only used for entities where the row count is not determined by a foreign key relationship. Ignored if either:
records
is set tounique
The entity has one or more fields that use the Foreign Key generator with a distribution set to something other than
none
.
view
If true
, the entity is generated as a view.
sql
If view
is true
, the SQL to use to generate the view.
Otherwise ignored.
is_static
true
if the entity is backed by a static CSV file.
Otherwise false
.
source
Present if the entity is backed by a static CSV file or has an attached CSV file.
source.data
The raw data from the CSV file.
source.filename
The name of the CSV file.
constraints
List of constraints.
fields
List of fields.
For views, this is ignored.
Constraints attributes
Each constraint object can contain the following attributes:
constraint_type
The type of constraint.
Either unique
or not-equal
.
fields
The names of the fields that the constraint applies to.
Field (database column) attributes
A field is equivalent to a database column.
Each field object can contain the following attributes:
seed
All
The seed for the field.
percent_null
All
virtual
All
group_key
All
postprocessing_sql
All
data_type
All
The data type for the field in the target database.
index
All
min
A minimum value.
max
A maximum value.
decimals
A number of decimal places to include in a value.
mean
A mean value.
std_dev
A standard deviation value.
rate
A rate of increase value.
success_probability
A success probability value.
distribution
The type of distribution for the value.
curve_type
The type of curve for a series of numerical values.
curve_type_field
When curve_type
is from_column
, the field to use as the basis for the curve.
volatility
The volatility to apply to a series of numerical values.
volatility_type
The type of volatility.
volatility_field
When volatility_type
is from_column
, the field to use as the basis for the volatility.
start_date
The earliest date value.
end_date
The latest date value.
date_only
Whether to only include dates and not times in the datetime values.
date_type
Whether the generated datetime values are absolute, relative, or a series.
date_operator
For relative datetimes, the comparison operator (before or after)
date_unit
For relative or series datetimes, the unit of time.
time_range_start_hour
For series datetimes, the start hour of the range.
time_range_end_hour
For series datetimes, the end hour of the range.
date_only_weekdays
For series datetimes, whether to only generate datetime values that occur on weekdays.
start_field
For series of numbers or datetime values, the column to use for the start of the series. For relative datetimes, the column to use for the relative date.
end_field
For series of numbers or datetime values, the column to use for the end of the series.
constant_value
The constant value to assign to the field.
regex
The regular expression pattern that the field value must match.
lorem_ipsum_unit
The unit of content to generate - words, sentences, or paragraphs.
character_sequence
The pattern to use for the character sequence.
sql
The SQL to use to generate the field values.
protocol
Whether to include the protocol in the generated URLs.
domain
Whether to include the domain in the generated URLs.
path
Whether to include the path in the generated URLs.
query
Whether to include a query in the generated URLs.
filename
Whether to include a filename in the generated URLs.
ip_address_version
The type of IP address (IPv4 or IPv6) to generate.
phone_number_format
The format to use for the telephone number.
partition_by_field
The field to use to partition the data.
order_by_field
The field to use to sort the rows within each partition.
primary_key_entity
The referenced table.
primary_key_field
The referenced field from the referenced table.
primary_key_cardinality_field
The field that contains the number of rows to generate.
value_field
The source column for a column from another table. The column to sum values for. The column to configure the number of values for a foreign key.
enable_where
Whether to select values based on provided criteria.
foreign_key_field
The name of a foreign key field.
conditions
condition.subset_field
The name of the field to use to filter the generated values for the current field.
condition.operator
The comparison operator to use to check the values in subset_field.
condition.subset_value
A comma-separated list of values to use for the in and not in comparisons.
variants
A set of variants for a distribution of numeric values.
Last updated