-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛Destination-Bigquery: Added an explicit error message if sync fails due to a config issue #21144
Changes from 1 commit
b4adc67
29b8f3e
f7cb7cd
4ccf5a2
6eaf084
bd87773
d397d41
8f1dd61
66bf0d7
e698b4d
2e59874
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,13 +9,15 @@ | |
import com.amazonaws.services.s3.AmazonS3; | ||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.google.cloud.bigquery.BigQuery; | ||
import com.google.cloud.bigquery.BigQueryException; | ||
import com.google.cloud.bigquery.FormatOptions; | ||
import com.google.cloud.bigquery.JobId; | ||
import com.google.cloud.bigquery.JobInfo; | ||
import com.google.cloud.bigquery.Schema; | ||
import com.google.cloud.bigquery.TableDataWriteChannel; | ||
import com.google.cloud.bigquery.TableId; | ||
import com.google.cloud.bigquery.WriteChannelConfiguration; | ||
import io.airbyte.commons.exceptions.ConfigErrorException; | ||
import io.airbyte.integrations.destination.bigquery.BigQueryUtils; | ||
import io.airbyte.integrations.destination.bigquery.formatter.BigQueryRecordFormatter; | ||
import io.airbyte.integrations.destination.bigquery.uploader.config.UploaderConfig; | ||
|
@@ -30,6 +32,26 @@ | |
|
||
public class BigQueryUploaderFactory { | ||
|
||
private static final String CONFIG_ERROR_MSG = """ | ||
\n | ||
******************************************************************************************** | ||
|
||
Failed to write to destination schema. | ||
|
||
1. Make sure you have all required permissions for writing to the schema. | ||
|
||
2. Make sure that the actual destination schema's location corresponds to location provided | ||
in connector's config. | ||
|
||
3. Try to change the "Destination schema" from "Mirror Source Structure" (if it's set) tp the | ||
"Destination Default" option. | ||
|
||
******************************************************************************************* | ||
|
||
More details: | ||
|
||
"""; | ||
|
||
public static AbstractBigQueryUploader<?> getUploader(final UploaderConfig uploaderConfig) | ||
throws IOException { | ||
final String schemaName = BigQueryUtils.getSchema(uploaderConfig.getConfig(), uploaderConfig.getConfigStream()); | ||
|
@@ -141,7 +163,13 @@ private static BigQueryDirectUploader getBigQueryDirectUploader( | |
.setProject(bigQuery.getOptions().getProjectId()) | ||
.build(); | ||
|
||
final TableDataWriteChannel writer = bigQuery.writer(job, writeChannelConfiguration); | ||
final TableDataWriteChannel writer; | ||
|
||
try{ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: space between There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, thanks. Please ignore the code-style issues for now. Once everything is approved I usually run the gradle's "format" command along with version bumping. So such issues would be automatically fixed. |
||
writer = bigQuery.writer(job, writeChannelConfiguration); | ||
}catch (final BigQueryException e){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: spaces There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated, thanks. Please ignore the code-style issues for now. Once everything is approved I usually run the gradle's "format" command along with version bumping. So such issues would be automatically fixed. |
||
throw new ConfigErrorException(CONFIG_ERROR_MSG + e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is there a way to make this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To tell the truth, this is what I did from the very beginning - i.e. added a catch to check the only exceptions with 404 in message. But after playing a bit more I noticed that all other possible issues were also related to config issues. So then updated code to catch everything as ConfigError. At this part of code, we just create a new connection. So whatever will go wrong - will be more or less related to the config issue. Should I anyway update it to catch the 404 only? Thanks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally, we'd catch specific error codes and provide error messages specific to those codes. Here is the list of error codes (https://cloud.google.com/bigquery/docs/error-messages). I don't think we can run into all of these here. We can probably assume that we will mostly run into |
||
} | ||
|
||
// this this optional value. If not set - use default client's value (15MiG) | ||
final Integer bigQueryClientChunkSizeFomConfig = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm..., so I like the formatting in the expanded log view, but I think I would prefer removing the long line of stars so that the message is easier to read in the non-expanded view (judging by the screenshot attached to the PR).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed stars, thanks. Previously just added it to make the error message more noticeable and fancy :)