데이터 품질 프로파일링 및 검증
이 빠른 시작에서는 Knowledge Catalog (이전 명칭: Dataplex Universal Catalog)를 사용하여 BigQuery 테이블을 프로파일링하고, 프로필 통계를 기반으로 데이터 품질 규칙을 정의하고, 데이터 품질 스캔을 실행하는 방법을 보여줍니다.
다음 단계를 완료합니다.
- 의도적인 이상치(예: 중복 및 null 값)가 포함된 샘플 자전거 공유 데이터로 BigQuery 데이터 세트와 테이블을 만들어 스캔 기능을 테스트합니다.
- 테이블에서 데이터 프로필 스캔을 만들어 실행합니다. 데이터 프로파일링은 null 비율, 고유 값 수, 값 분포와 같은 열 수준 통계를 계산합니다. 자세한 내용은 데이터 프로파일링 정보를 참고하세요.
- 데이터 프로필 스캔 결과를 검토하여 패턴과 잠재적 이상치를 찾습니다.
- 프로필 결과를 기반으로 데이터 품질 규칙을 정의하고 데이터 품질 스캔을 실행합니다. 데이터 품질 스캔은 정의된 규칙에 따라 데이터를 검증하여 이상을 식별합니다. 자세한 내용은 자동 데이터 품질 정보를 참고하세요.
- 평가 결과를 검토하여 통과하거나 실패한 품질 규칙을 확인합니다.
시작하기 전에
프로젝트를 다음과 같이 설정하세요.
- Google Cloud 계정에 로그인합니다. Google Cloud를 처음 사용하는 경우 계정을 만들고 Google 제품의 실제 성능을 평가해 보세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Knowledge Catalog and BigQuery APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Knowledge Catalog and BigQuery APIs.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.
필요한 역할
데이터 프로필 및 데이터 품질 스캔을 만들고 실행하고 BigQuery 리소스를 관리하는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 다음 IAM 역할을 부여해 달라고 요청하세요.
-
데이터 스캔 만들기, 실행, 삭제: Dataplex DataScan 편집자 (
roles/dataplex.dataScanEditor) -
샘플 테이블 만들기, 채우기, 삭제: BigQuery 데이터 소유자 (
roles/bigquery.dataOwner) -
BigQuery에서 SQL 쿼리 실행:
BigQuery 작업 사용자 (
roles/bigquery.jobUser)
역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.
커스텀 역할이나 다른 사전 정의된 역할을 통해 필요한 권한을 얻을 수도 있습니다.
프로젝트에서 IAM 액세스를 관리하는 데 필요한 권한이 있는 경우 다음 gcloud 명령어를 실행하여 사용자 계정에 이러한 역할을 부여할 수 있습니다.
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/dataplex.dataScanEditor"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.dataOwner"
gcloud projects add-iam-policy-binding PROJECT_ID \
--member="user:USER_EMAIL" \
--role="roles/bigquery.jobUser"
다음을 바꿉니다.
PROJECT_ID: Google Cloud 프로젝트 ID입니다.USER_EMAIL: 사용자 계정 이메일 주소 (예:name@example.com)
Knowledge Catalog 서비스 에이전트에 권한 부여
서비스 에이전트는 Knowledge Catalog가 사용자를 대신하여 BigQuery에서 스캔 쿼리를 실행하는 데 사용하는 Google 관리 서비스 계정입니다.
Google Cloud 콘솔의 툴바에서 Cloud Shell 활성화를 클릭합니다. 환경을 프로비저닝하고 연결하는 데 몇 분 정도 걸립니다.
Knowledge Catalog 서비스 에이전트를 만듭니다.
gcloud beta services identity create --service=dataplex.googleapis.com이 명령어는 서비스 에이전트가 아직 프로비저닝되지 않은 경우 서비스 에이전트를 만들고 이메일을 출력합니다. 프로젝트에 이미 Knowledge Catalog 서비스 에이전트가 있는 경우 명령어는 변경 없이 기존 ID를 반환합니다.
출력은 다음과 비슷합니다.
serviceAccount:service-PROJECT_NUMBER@gcp-sa-dataplex.iam.gserviceaccount.com다음 단계를 위해 출력에서
PROJECT_NUMBER를 기록합니다.Knowledge Catalog가 프로젝트에서 쿼리 작업을 실행할 수 있도록 BigQuery 작업 사용자 (
roles/bigquery.jobUser) 역할을 부여합니다.gcloud projects add-iam-policy-binding PROJECT_ID \ --member="serviceAccount:service-PROJECT_NUMBER@gcp-sa-dataplex.iam.gserviceaccount.com" \ --role="roles/bigquery.jobUser"
다음을 바꿉니다.
PROJECT_ID: Google Cloud 프로젝트 ID입니다.PROJECT_NUMBER: Google Cloud 프로젝트 번호입니다.
서비스 에이전트가 테이블 데이터와 스키마를 읽을 수 있도록 BigQuery 데이터 뷰어 (
roles/bigquery.dataViewer) 역할을 부여합니다.gcloud projects add-iam-policy-binding PROJECT_ID \ --member="serviceAccount:service-PROJECT_NUMBER@gcp-sa-dataplex.iam.gserviceaccount.com" \ --role="roles/bigquery.dataViewer"
다음을 바꿉니다.
PROJECT_ID: Google Cloud 프로젝트 ID입니다.PROJECT_NUMBER: Google Cloud 프로젝트 번호입니다.
샘플 데이터 세트 및 테이블 만들기
프로덕션 데이터를 건드리지 않고 안전하게 프로파일링 및 데이터 품질 스캔을 사용해 보려면 전용 BigQuery 데이터 세트를 설정하고 프로젝트에 직접 샘플 데이터가 포함된 테이블을 만드세요.
콘솔
Google Cloud 콘솔에서 BigQuery 페이지로 이동합니다.
탐색기 창에서 프로젝트 ID 옆에 있는 작업 보기를 클릭한 다음 데이터 세트 만들기를 클릭합니다.
데이터 세트 ID 필드에
quickstart_data_profile를 입력합니다.데이터 위치 목록에서 us-central1 (아이오와)을 선택합니다.
데이터 세트 만들기를 클릭합니다.
쿼리 편집기에서 다음 SQL 쿼리를 입력하여
bikeshare_trips테이블에 샘플 자전거 공유 데이터를 생성합니다.CREATE OR REPLACE TABLE `PROJECT_ID.quickstart_data_profile.bikeshare_trips` AS SELECT