Multiples Stages
The scheme allows you to define different usage scenarios. These usage scenarios can be used for different reasons, for example:
- You can create a scenario to work with an Oracle Base and another with SqlServer with the same definition of the business model to perform performance tests.
- You can configure one stage as a source and another as a destination to perform data migrations.
- You can define one stage for read operations and another for write operations.
- You can define one stage for the development environment and another for the qa environment.
Schema Example
In this scheme we can see how to extend the schema.
We use the extends attribute in the definition of the schema to extend it.
domain:
entities:
- name: Countries
primaryKey: ["iso3"]
uniqueKey: ["name"]
properties:
- name: name
required: true
- name: iso3
length: 3
required: true
relations:
- name: states
type: manyToOne
composite: true
from: iso3
entity: States
to: countryCode
- name: States
primaryKey: ["id"]
uniqueKey: ["countryCode", "name"]
properties:
- name: id
type: integer
required: true
- name: name
required: true
- name: countryCode
required: true
length: 3
relations:
- name: country
from: countryCode
entity: Countries
to: iso3
infrastructure:
mappings:
- name: mapping1
- name: mapping2
entities:
- name: Countries
mapping: TBL_COUNTRIES
properties:
- name: iso3
mapping: ISO3
- name: name
mapping: NAME
- name: States
mapping: TBL_STATES
properties:
- name: id
mapping: ID
- name: name
mapping: NAME
- name: countryCode
mapping: COUNTRY_CODE
sources:
- name: source1
dialect: MySQL
mapping: mapping1
connection: $CNN_MYSQL
- name: source2
dialect: PostgreSQL
mapping: mapping2
connection: $CNN_POSTGRES
stages:
- name: stage1
sources:
- name: source1
- name: stage2
sources:
- name: source2
Environment Variables:
CNN_MYSQL={"host":"localhost","port":3306,"user":"test","password":"test","database":"test"}
CNN_POSTGRES={"host":"0.0.0.0","port":5433,"user":"test","password":"test","database":"test"}