Issues with DQDL CustomSQL syntax

1

I'm trying to do something really basic with a CustomSQL but can't figure out how to get DQDL to parse and save the ruleset. Let's say we have columns a and b and we want to make sure that whenever the value of column a is "foo" the column b should contain "bar". I tried to solve the problem with the following ruleset

Rules = [
    CustomSql "select b from primary where a = 'foo'" = "bar"
]

This results in a "InvalidInputException (status: 400): DataQuality rules cannot be parsed". Am I doing something wrong or is this just not possible to do?

Koura
질문됨 일 년 전320회 조회
2개 답변
2
수락된 답변

CustomSQL commands in DQDL are not meant for giving a row by row data quality indication , rather they should calculate an overall data quality for the whole dataset. SQL queries should return a single numeric value (ref. documentation).

To achieve what you want, you need to write a SQL query to count all the rows where a is equal to 'foo' and b is not equal to 'bar' and then you need to check this count against a numeric threshold (zero for all compliant data) in DQDL rule.

AWS
전문가
답변함 일 년 전
0

There are two types of use cases for the CustomSQL rule. In my case, I want to use a rule of the Custom SQL to retrieve row-level results type. For example: CustomSql "select Name from primary where Age > 18".

However, every time I use a rule of this type, I get the following error: 'No condition provided for rule with non-boolean rule type: CustomSql'. I can't even save the ruleset.

When using rules of the type: CustomSql "select count(*) from primary" between 10 and 20, I don't encounter any issues.

I don't understand why it's giving an error if it's a use case mentioned in the documentation. I've already tried it with different databases but still the same problem... :(

Azahara
답변함 8달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠