Skip to content

Commit

Permalink
Supoort resource type of change_event
Browse files Browse the repository at this point in the history
  • Loading branch information
mzumi committed Nov 10, 2023
1 parent 333b1e3 commit 9cc9ec9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/org/embulk/input/google_ads/GoogleAdsReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ public String buildQuery(PluginTask task)
sb.append(String.join(" AND ", whereClause));
}

if (task.getLimit().isPresent()) {
sb.append(" LIMIT ");
sb.append(task.getLimit().get());
}

return sb.toString();
}

Expand All @@ -231,7 +236,11 @@ public List<String> buildWhereClauseConditions(PluginTask task)

if (task.getDateRange().isPresent()) {
StringBuilder dateSb = new StringBuilder();
dateSb.append("segments.date BETWEEN '");
if (task.getResourceType().equals("change_event")) {
dateSb.append("change_event.change_date_time BETWEEN '");
} else {
dateSb.append("segments.date BETWEEN '");
}
dateSb.append(task.getDateRange().get().getStartDate());
dateSb.append("' AND '");
dateSb.append(task.getDateRange().get().getEndDate());
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/embulk/input/google_ads/PluginTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ public interface PluginTask extends Task
@ConfigDefault("null")
Optional<GoogleAdsDateRange> getDateRange();

@Config("limit")
@ConfigDefault("null")
Optional<String> getLimit();

@Config("_use_micro")
@ConfigDefault("true")
boolean getUseMicro();
Expand Down

0 comments on commit 9cc9ec9

Please sign in to comment.