Models and Attributes
Now that we have configured details for the Dore_Ecommerce database, we need to provide definitions for the
Customer and Order tables of the e-commerce schema.
In Dore, A Model represents a set of structured data. Models usually correspond to tables/collections/indexes in a database/cluster. Attributes correspond to columns/fields.
Let's add the models object in the manifest which will contain the model definitions:
| dore-ecommerce-manifest.json | |
|---|---|
We will be adding definitions for each of the tables of the ecommerce schema.
Models
Like datastores, each model is defined with a key which will be the ID for the Model and value as the Model Definition.
Let's add two models, customer and order, corresponding to Customer and Order tables of the
ecommerce schema:
| dore-ecommerce-manifest.json | |
|---|---|
Linked Datastore
Since Customer and Order tables need to be created within the Dore_Ecommerce database, we define that both
customer and order models are associated with the ecommerce datastore:
Records
We need to define the count of records that Dore should generate for each of the models. So let's define this for
the customer and order models as follows:
With the records field on the models, we have defined that Dore should generate 10 records for the customer
model and 100 records for the order model.
Attributes
The Customer table of the e-commerce schema has two columns:
customer_idcustomer_name
And the Order table has three columns:
order_idcustomer_idorder_date
In order to add definitions for these columns in the manifest, we need to define
Attributes for the customer and order models corresponding to these
columns.
Attributes for a model are defined at $.models[*].attributes in the Manifest; i.e, within the attributes field for
a model. Like datastores and models, each attribute is defined with a key which will be the ID for the Attribute and
value as the Attribute Definition.
We will be now be adding value definitions for the attributes above.
➡ Next: Attribute Value Definition