Release - September 28th, 2021
#
β¨ New β¨#
Python InterfaceDetails
Product Component
Interfaces - Python
More Detail
Our Python Interface is shipped with Transform MQL and allows users to express MQL requests in Python scripts and notebooks.
Verification Steps
Installation Instructions
Same as the CLI
PyPI link: https://pypi.org/project/transform/
pip install transform
Auth setup
# Follow the prompts to either enter api_key or perform MFAmql setup
Python Library
Before querying Transform using the Python Interface, you should authenticate using an API key by running the following:
mql setup -k <your api key>
NOTE: All configs including pinned models, api_key, bearer tokens will be stored under the default directory at ~/.transform/config.yml
. If another location is desired, please set an ENV variable at $TFD_CONFIG_DIR
with the desired path.
Examples of Querying Metrics
To pull this into a notebook or Python script, you can run the following, which shows an example of querying a metric called messages
with dimensions ds
, and a where constraint.
from transform import mql
df = mql.query(metrics=["messages"], dimensions=["ds"], where="is_thread")
You can optionally instantiate the object manually. This will allow you to pass an API key and authenticate, and you should use this mechanism if you are not already authenticated via mql setup
.
from transform.mql import MQLClient
mql = MQLClient(api_key: Optional[str], mql_server_url: Optional[str])df = mql.query(metrics=["messages"], dimensions=["ds"], where="is_thread")
Python Interface Functions
The interface supports most commands that Tranform's MQL CLI supports.
Note if you instantiated the MQL object manually, you should use MQLClient.<function>
instead of mql.function
(as listed below).
mql.query(metrics, dimensions, model_key_id=None, where=None, time_constraint=None, time_granularity=None, order=None, limit=None, cache_mode=None, as_table=None)
mql.create_query(metrics, dimensions, model_key_id=None, where=None, time_constraint=None, time_granularity=None, order=None, limit=None, cache_mode=None, as_table=None)
mql.list_queries(active_only, limit=None)
mql.list_metrics(model_key_id=None)
mql.list_servers()
mql.create_materialization(materialization_name, start_time, end_time, model_key_id=None, output_table=None)
mql.materialization(materialization_name, start_time, end_time, model_key_id=None, output_table=None)
mql.drop_materialization(materialization_name, start_time, end_time, model_key_id=None, output_table=None)
mql.commit_configs(config_dir)
mql.validate_configs(config_dir)
mql.health_report()
mql.drop_cache()
mql.identify()
mql.ping()
#
More Time Granularity Support in the FrameworkDetails
Product Component
Metrics Framework
More Detail
When defining a data source with a primary time dimension, it is now possible to use other granularities other than day
, which include week
, month
quarter
, and year
). This will appropriately constrict the options possible when working with a metric (e.g. can't query at a DAY granularity if the metric is defined at a WEEK granularity), and also properly aggregate when querying metrics with different time granularities (e.g. querying two metrics, one with a DAY granularity and another with a MONTH granularity will return a result with a MONTH granularity by default). In addition to having appropriate metadata, the specified granularity will allow graphs in the UI to render correctly (e.g. a DAY granularity can't be specified for a MONTHLY metric).
Verification Steps
Create a data source with a primary time dimension at a granularity other than a day. Verify that the metric can't be queried using a finer time granularity, and also verify that when querying with a metric that is at a different time granularity, the results are returned with the smallest common time granularity.
#
Metric Charts now start at 0Details
Product Component
Metrics Catalog
More Detail
The y-axis on our charts previously started at a minimum value for the dataset instead of zero. This sometimes led to misleading visual trends because drops and increases look more drastic than they actually are. As a result, we updating both charts on the metric page and homepage to start with 0 by default on the y-axis. For the charts with negative y values, the axis will still start with the minimum value. At a later time, we'll add customizability options to y-axis bounds for cases where a limited range might be useful.
Verification Steps
Confirm all charts with all positive y values start at zero.
Confirm all charts with negative y values remains the same
#
New Debug and Web Commands in CLIDetails
Product Component
Interfaces - MQL CLI
More Detail
In MQL CLI, we have added two flags, --debug
and --web
for query
, drop-materialization
, and materialize
commands.
--debug
is used to show the mql server side log during the query execution. The log will be the same as what is printed when running mql stream_query_logs
.
--web
is used to open the MQL query log web page (https://app.transformdata.io/mql/query_logs) so that users can browse the log, see the result, etc, through web browsers.
Verification Steps
With the MQL Cli (versionβ₯ v0.0.39), you can add the two flags in the three commands aforementioned, the log should be printed and a web page should be opened automatically.
#
π Bug Fixes π#
Bug with Create Metric True with no metrics definedDetails
Product Component
Metrics Framework
More Detail
We fixed a bug where when you had create_metric: true
set for measures without having any metrics in your model, validation does fail.
Verification Steps
Confirm you can set create_metric: true
without having metrics in your model.
#
Saved Query Form ClearingDetails
Product Component
Metrics Catalog
More Detail
There has been a bug when creating or updating a Saved Query where the Saved Query form clears itself while the preview chart is loading and you are typing. This has been resolved.
Verification Steps
Navigate to a Metric Page. Filter the chart, click "More Actions", select "Save New Query". Fill in the Saved Query form and see it no longer clears while you are typing!