Introduce AML 2.0 Module
Modules are the official way to organize an AML project by grouping similar AML objects and functions together.
For example, they could be a set of objects type (models, dataset) or functions (cohort, mrr, recurring, etc) that you can reuse throughout your AML project.
Using modules, you would be able to follow Modular Data Modeling’s best practices. Organizing related concepts together helps create a neat, uniform structure for your projects. They allow for easier code refactoring and future code reuse.
One way to incorporate selected modules into your project is to use the use
keyword.
|-- index.aml
|-- modules
| |-- cohort
| | |-- retention_table.aml
| | |-- cohort_items.aml
| |-- utils
| | |-- date_time.aml
| | |-- modules
| | | |-- region
| | | | |-- region_items.aml
use cohort { retention_table, cohort_items: items } // alias cohort_items to items
use utils { date_time }
use utils.region // bring all the items in the module utils.region into this file
utils.date_time // or refer to module's item directly
Object names are unique within module scope
In AML 2.0, object names will be unique in module scope. If you are migrating from AML 1.0 and have duplicated object names in the same module, their name would be appended with a number suffix i.e _1, _2
.
Import object statements are no longer required
Since object names will be unique across projects, importing the external files is not required.
Adding datasets to index.aml is no longer required
The file index.aml
will no longer be necessary since all the datasets defined in the As-code layer will be published to the end-users in Reporting.
You don’t have to remember to add datasets to the file index.aml
anymore.