How data fetching works
There are two ways to reference data in Morph’s workspace from an MDX file: using a data component or a data retrieval function.
In both cases, the data retrieval request is handled by Morph’s internal API. Upon receiving the request, it executes SQL or Python and returns the result.
There are three types of response.
-
JSON … SQL query results or Python function return values in the form of DataFrames or dictionaries can be retrieved as JSON.
-
HTML … If the return value of a Python function is HTML, such as a Plotly graph, it can be retrieved as an HTML string.
-
Image … If the return value of a Python function is an image, such as a matbplotlib graph, you can retrieve the image as a string in Base64 format.
When you can use prepared components, such as table views or graphs drawn with Plotly, we recommend using them.
If you want to do something more complicated, consider using the data acquisition functions.