Are you able to elaborate on what the goal is in this situation?
Most commonly, Data Expectations are used to evaluate conditions endogenous to the current transaction. That is – it’s easy to supply checks with information availabe in the dataset and, optionally, the previous or current transaction if it’s an incremental transform. Data Health Checks, in contrast, are most commonly used to evaluation conditions that could span multiple transactions (e.g. how long has it been since the previous successful build?).
That said, if you really want to make an API call in the context of this data expection, here’s how you could do it:
First, get the transaction associated with the branch you care about (use Python instead of curl in your transform, but I’m going to use curl for demo purposes). Often, the branch id you want is master
:
curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" $HOST/foundry-catalog/api/catalog/datasets/[DATASET_RID]/branches2/[BRANCH_ID]
Next, use the transaction id returned from that to get all the info you’re interested in:
curl -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" $HOST/foundry-catalog/api/catalog/datasets/[DATASET_ID]/transactions/[TRANSACTION_ID]
The response will look something like this:
{
"type": "SNAPSHOT",
"status": "COMMITTED",
"filePathType": "MANAGED_FILES",
"startTime": "2024-07-01T02:12:16.584Z",
"closeTime": "2024-07-01T02:13:01.510Z",
"permissionPath": "REDACTED/REDACTED",
"record": {
"jobRid": "ri.foundry.main.job.REDACTED",
"runRid": "ri.foundry.main.job.REDACTED"
},
"attribution": {
"userId": "REDACTED",
"time": "2024-07-01T02:12:16.584Z"
},
"metadata": {
"fileCount": 2,
"totalFileSize": 1608621,
"hiddenFileCount": 1,
"totalHiddenFileSize": 1469119
},
"isDataDeleted": false,
"isDeletionComplete": false,
"rid": "ri.foundry.main.transaction.REDACTED",
"provenance": {
"provenanceRecords": [
{
"datasetRid": "ri.foundry.main.dataset.REDACTED",
"transactionRange": {
"startTransactionRid": "ri.foundry.main.transaction.REDACTED",
"endTransactionRid": "ri.foundry.main.transaction.REDACTED"
},
"schemaBranchId": "master",
"schemaVersionId": "REDACTED",
"nonCatalogResources": [],
"assumedMarkings": []
}
],
"nonCatalogProvenanceRecords": []
},
"datasetRid": "ri.foundry.main.dataset.REDACTED"
}