Enhancement: Use timestamp returned from the server in QueryResult #529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Scope of this PR:
queryDataTime
field from the GraphQL of the query, put the value inQueryResult.query_data_time
(convert to datetime, assumequeryDataTime
is a UTC timestamp)as_of
argument toDatasource.log_to_mlflow()
, that specifies the query timestampQueryResult.query_data_time
is passed to the MLflow logging function.DatasourceSerializedState.timed_link
field, which has different semantics fromDatasourceSerializedState.link
:as_of
already set up on the query, then it is the same aslink
as_of
from the Query is used there (or datetime.now if it was logged by the user with no as_of)I decided to go the way of adding a new argument to a function so as to not move the whole
log_to_mlflow
function fromDatasource
toQueryResult
. Considering that we mostly not expectlog_to_mlflow
to be called by users, and instead they should utilize autologging, this is an OK compromise.The only UX friction I envision is using
Datasource.log_to_mlflow()
will now have an additional optional argument, and if the user is using that to save their datasources, they might miss that the time can also be saved there. If you consider that a problem, I can go back to the drawing board and migrate the function toQueryResult.log_to_mlflow