Incompatible table partitioning specification when copying to the column partitioned table
embulk plugin에서 embulk-output-bigquery부분에서 아래와 같은 오류가 날 때 해결 방법에 대해서 적어 봤습니다.
Incompatible table partitioning specification when copying to the column partitioned table |
위의 오류는 mysql -> big query로 갈 때 big query 쪽에 이미 partition이 되어 있는 경우 발생하였습니다. 상황에 따라서 다양하게 발생하는 것으로 보이는데 저의 경우 위의 상황으로 발생하였습니다.
관련해서 embulk plugin 쪽에 내용을 보면 다음과 같이 표기되어 있습니다.
아래의 내용은 mode에서 replace를 사용할 때 관련된 내용인 거 같은데, 사실 해결 방법과 별 상관이 없는 듯합니다...
replace
is_skip_job_result_check must be false when replace mode NOTE: BigQuery does not support replacing (actually, copying into) a non-partitioned table with a paritioned table atomically. You must once delete the non-partitioned table, otherwise, you get Incompatible table partitioning specification when copying to the column partitioned table error. |
제가 힌트를 얻은 부분은 일본어 사이트에서 힌트를 얻었습니다.
구글 번역으로 돌려봤는데, input에서 partion으로 잡은 날짜(timestamp)를 정상적으로 읽었으나 output으로 갈 때는 그러지 못하는 듯하다는 내용입니다. 그래서 강제로 output에서 받을 때 이 칼럼을 날짜(timestamp)로 인식하도록 지정하여서 해결하였습니다.
아래와 같이 설정하였습니다.
out: type: bigquery auth_method: json_key json_keyfile: C:\google\key.json schema_file: C:\embulk\schema.json project: project_test dataset: log table: test_table gcs_bucket: temp_bucket mode: append_direct open_timeout_sec: 7200 send_timeout_sec: 7200 read_timeout_sec: 7200 column_options: - {name: created_at, type: STRING, timestamp_format: "%Y-%m-%d %H:%M:%S",timezone: "UTC"} # UTC |
위의 옵션으로 넣었을 때 정상적으로 동작하는 것을 확인하였습니다.
뒤에 timezone의 경우 KST였던 로그를 UTC로 변환해야 하는 이슈가 있어서 옵션을 추가하였습니다.
감사합니다.
참고
https://qiita.com/Tomoyuki_Mikami/items/c69dd06c743b731959a2
embulk で BQ in BQ out で Partitioned tables に躓いた - Qiita
#やりたいこと Embulk で BigQuery -> BigQuery がやりたい。 out側のテーブルは Partitioned tables としたい(DATE型またはTIMESTAMP型のカラムを指定) #やったこと...
qiita.com
https://github.com/embulk/embulk-output-bigquery#column-options