-
Notifications
You must be signed in to change notification settings - Fork 3
Support for project & destination_project #103
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
Conversation
| public final String destinationProject; // FIXME: should be private | ||
| public final String destinationDataset; // FIXME: should be private |
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.
Could you tell me why these properties can't be private ?
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.
These variables are referenced from outside of this class to output to logs.
I think it would be better to refactor the handling of global variables overall.
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.
OK, Thanks. That seems better to do separately.
| private String getProjectIdFromJsonKeyfile() { | ||
| return new JSONObject( | ||
| new JSONTokener(new ByteArrayInputStream(task.getJsonKeyfile().getContent()))) | ||
| .getString("project_id"); | ||
| } |
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.
It's better to have error handling like return null when exception caught.
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.
Fixed.
1c6215f
| this.schema = schema; | ||
| this.dataset = task.getDataset(); | ||
| project = task.getProject().orElse(getProjectIdFromJsonKeyfile()); | ||
| destinationProject = task.getDestinationProject().orElse(project); |
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.
If destinationProject could be null here, there should be error throwing maybe?
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.
Fixed project to never be null, so destinationProject will also never be null.
Changes:
auth_method&json_keyfileproperly.authorized_usertoauth_method.json_keyfileto useLocalFileinstead ofStringto supportcontentnotation.project&destination_project.projectexplicitly.destination_projectoverall.Confirmation script:
type:bigquery_javabigqueryauth_method:authorized_userservice_accountdestination_project:systemn-playgroundtest-by-sanomode:appendappend_directreplacedelete_in_advancemergerun.sh