【发布时间】:2022-07-14 02:45:30
【问题描述】:
我有一个数据集,它是 Palantir Foundry 代码库中定义的 Python 转换的输出。它有一个主键,但考虑到随着时间的推移数据可能会发生变化,我想在将来验证这个主键是否成立。
如何创建数据健康预期或检查以确保主键在未来保持不变?
【问题讨论】:
标签: palantir-foundry foundry-code-repositories
我有一个数据集,它是 Palantir Foundry 代码库中定义的 Python 转换的输出。它有一个主键,但考虑到随着时间的推移数据可能会发生变化,我想在将来验证这个主键是否成立。
如何创建数据健康预期或检查以确保主键在未来保持不变?
【问题讨论】:
标签: palantir-foundry foundry-code-repositories
您可以在 Python 转换中定义数据预期,例如:
from transforms.api import transform_df, Input, Output, Check
from transforms import expectations as E
@transform_df(
Output("/path/to/output"),
source_df=Input("/path/to/input", checks=[
Check(E.primary_key("thing_id"), "primary_key: thing_id"),
]),
)
def compute(source_df):
return source_df.select("thing_id", "thing_name").distinct()
更多信息请访问Palantir Foundry documentation on defining data expectations。
【讨论】: