Alias
Aliases are a mechanism for assigning identifiers to Python functions, SQL queries, etc. throughout the Morph framework so that they can be easily referenced from other files.
Using aliases, you can combine functions and queries spread across multiple files, build data pipelines, and reference data from a front-end built with markdown.
Setting up Aliases
Setting up an Alias for a Python Function
To set up an alias for a Python function, use the @morph.func(name="alias")
decorator.
If the name is not specified, the function name will be used as the alias.
Setting up an Alias for an SQL Query
To set up an alias for an SQL query, use config(name="alias")
.
Referencing Data Using Aliases
Referencing Data in Python
To reference data using an alias in a Python function, use the @morph.load_data("alias")
decorator.
Referencing Data in Markdown
When using data-referencing components such as <DataTable>
or <Embed>
, specify the alias to reference the data.