Skip to content

Commit

Permalink
google sheets and analytics transforms version upgrade, initial doc v…
Browse files Browse the repository at this point in the history
  • Loading branch information
bamaer committed Jul 19, 2023
1 parent c6d3c56 commit 10b7e50
Show file tree
Hide file tree
Showing 19 changed files with 316 additions and 92 deletions.
43 changes: 11 additions & 32 deletions assemblies/plugins/tech/google/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
<description />

<properties>
<gax.version>2.27.0</gax.version>
<commons-vfs2.version>2.9.0</commons-vfs2.version>
<google-api-sheets.version>v4-rev612-1.25.0</google-api-sheets.version>
<google-api-drive.version>v3-rev197-1.25.0</google-api-drive.version>
<google-api-sheets.version>v4-rev20230526-2.0.0</google-api-sheets.version>
<google-api-drive.version>v3-rev20230610-2.0.0</google-api-drive.version>
<google-api-services-analytics.version>v3-rev169-1.25.0</google-api-services-analytics.version>
<google-api-services-drive.version>v3-rev197-1.25.0</google-api-services-drive.version>
<jetty-client.version>6.1.26</jetty-client.version>
Expand All @@ -51,12 +52,17 @@
<dependency>
<groupId>com.google.analytics</groupId>
<artifactId>google-analytics-data</artifactId>
<version>0.31.0</version>
<version>0.28.0</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-analytics-data-v1beta</artifactId>
<version>0.31.0</version>
<version>0.28.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.23.3</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
Expand Down Expand Up @@ -90,20 +96,10 @@
<artifactId>gax-grpc</artifactId>
<version>${gax.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.21.9</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.21.12</version>
</dependency>
<dependency>
<groupId>com.google.api.grpc</groupId>
<artifactId>proto-google-common-protos</artifactId>
<version>2.14.0</version>
<version>2.21.0</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
Expand Down Expand Up @@ -133,23 +129,6 @@
<artifactId>google-analytics-data</artifactId>
<version>0.28.0</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.23.3</version>
</dependency>
<!--
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-analytics</artifactId>
<version>${google-api-services-analytics.version}</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>${google-api-client.version}</version>
</dependency>
-->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
Expand Down
1 change: 0 additions & 1 deletion assemblies/plugins/tech/google/src/assembly/assembly.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
<include>com.google.code.gson:gson</include>
<include>com.google.analytics:google-analytics-data:jar</include>
<include>com.google.api.grpc:proto-google-analytics-data-v1beta:jar</include>
<include>com.google.protobuf:protobuf-java-util:jar</include>
</includes>
</dependencySet>
</dependencySets>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/hop-user-manual/modules/ROOT/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ under the License.
*** xref:pipeline/transforms/getsystemdata.adoc[Get System Info]
*** xref:pipeline/transforms/gettablenames.adoc[Get table names]
*** xref:pipeline/transforms/getvariable.adoc[Get variables]
*** xref:pipeline/transforms/google-analytics.adoc[Google Analytics Input]
*** xref:pipeline/transforms/google-sheets-input.adoc[Google Sheets Input]
*** xref:pipeline/transforms/google-sheets-output.adoc[Google Sheets Output]
*** xref:pipeline/transforms/groupby.adoc[Group By]
*** xref:pipeline/transforms/http.adoc[HTTP client]
*** xref:pipeline/transforms/httppost.adoc[HTTP Post]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ The pages nested under this topic contain information on how to use the transfor
* xref:pipeline/transforms/getsystemdata.adoc[Get System Info]
* xref:pipeline/transforms/gettablenames.adoc[Get table names]
* xref:pipeline/transforms/getvariable.adoc[Get variables]
* xref:pipeline/transforms/google-analytics.adoc[Google Analytics Input]
* xref:pipeline/transforms/google-sheets-input.adoc[Google Sheets Input]
* xref:pipeline/transforms/google-sheets-output.adoc[Google Sheets Output]
* xref:pipeline/transforms/groupby.adoc[Group By]
* xref:pipeline/transforms/http.adoc[HTTP client]
* xref:pipeline/transforms/httppost.adoc[HTTP Post]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The Google Analytics Input transform reads data from a Google Analytics 4 account.

= image:transforms/icons/google-analytics.svg[Google Analytics Input transform Icon, role="image-doc-icon"] Google Analytics Input

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Google Analytics Input transform reads data from a Google Analytics 4 account, using the Google Analytics Data API.

The https://ga-dev-tools.google/ga4/query-explorer/[GA4 Query Explorer] provides a dedicated website to developing and testing queries with the Google Analytics API (outside of Apache Hop).

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:question_mark.svg[Maybe Supported, 24]
!Flink! image:question_mark.svg[Maybe Supported, 24]
!Dataflow! image:question_mark.svg[Maybe Supported, 24]
!===
|===


== Configuration

* You need a Google Analytics account with access and sufficient permissions to a GA4 property.
* You need a Google Cloud project with a service account. The Google Analytics api needs to be enabled for this project.

Check the Google Cloud docs for more information on how the https://cloud.google.com/iam/docs/service-accounts-create[create a service account^] and to https://developers.google.com/analytics/devguides/reporting/data/v1/quickstart-client-libraries[set up a project^] for use with the Google Analytics Data API.


== Options

=== Google Analytics Connection Settings

[%header, width="90%"]
|===
|Option|Description
|Application name|Enter an application name such as "Apache Hop" or leave the default.
|OAuth service email|Your Google Developer Service Account's Email Address (e.g. "<random [email protected]>").
|Key file|The path to the P12 private key associated with your OAuth Service account.
|Property Id|the GA4 property to read from
|===

=== Query Definition

[%header, width="90%"]
|===
|Option|Description
|Start date (YYYY-MM-DD|Specifies the start date associated with the query. The date must be entered in the following format: YYYY-MM-DD.
|End date (YYYY-MM-DD|Specifies the end date associated with the query. The date must be entered in the following format: YYYY-MM-DD.
|Dimension|Specifies the dimension fields for which you want to query. The Google Analytics Data API documentation provides you with a list of valid inputs and metrics that can be combined.
|Metrics|Specifies the metrics fields you want returned. At least one metric must be provided.
|Sort|Specifies a dimension field on which to sort.
|===

=== Fields

Click **Get Fields** to retrieve a list of possible fields based on the query you defined.
Click **Preview** to preview data based on the defined query.

=== Limit Size

Limit the number of rows to retrieve for the specified GA4 property to a number of rows.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The Google Sheets Input transform reads data from a Google Sheets worksheets.

= image:transforms/icons/google-sheets-input.svg[Google Sheets Input transform Icon, role="image-doc-icon"] Google Sheets Input

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Google Sheets Input transform reads data from a Google Sheets worksheets.

This transform requires a Google service account (JSON file) and a Google Cloud project with the Sheets API enabled.

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:question_mark.svg[Maybe Supported, 24]
!Flink! image:question_mark.svg[Maybe Supported, 24]
!Dataflow! image:question_mark.svg[Maybe Supported, 24]
!===
|===

== Options

=== Service account tab

Click the `browse` button to pick your google service account client secret json file.

The `Test` button Lets you test your access to the API. On success, you should see a success message.

=== Spreadsheet tab

Lets you specify or browse for spreadsheets existing in the service account drive or for the ones that are shared with the service account email.

=== Fields tab

Lets you select from the fields of the sheet.

Fields name are always defined in the first line of the google spreadsheet.

**Get Fields** lets you get fields and guess their types, format, precision, decimal and group delimiter as well as trim type.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
////
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
////
:documentationPath: /pipeline/transforms/
:language: en_US
:description: The Google Sheets Output transform writes data to a Google Sheets worksheets.

= image:transforms/icons/google-sheets-output.svg[Google Sheets Output transform Icon, role="image-doc-icon"] Google Sheets Output

[%noheader,cols="3a,1a", role="table-no-borders" ]
|===
|
== Description

The Google Sheets Output transform writes data to a Google Sheets worksheets.

This transform requires a Google service account (JSON file) and a Google Cloud project with the Sheets API enabled.

|
== Supported Engines
[%noheader,cols="2,1a",frame=none, role="table-supported-engines"]
!===
!Hop Engine! image:check_mark.svg[Supported, 24]
!Spark! image:question_mark.svg[Maybe Supported, 24]
!Flink! image:question_mark.svg[Maybe Supported, 24]
!Dataflow! image:question_mark.svg[Maybe Supported, 24]
!===
|===

== Options

=== Service account tab

Click the `browse` button to pick your google service account client secret json file.

The `Test` button Lets you test your access to the API. On success, you should see a success message.

=== Spreadsheet tab

[%header, width="90%"]
|===
|Option|Description
|Spreadsheet key|Lets you specify or browse for spreadsheets existing in the service account drive or for the ones that are shared with the service account email. If you type in a sheet name (that does not exist in the drive) it will attempt to create a sheet it the "create" checkbox is ticked.
|Worksheet Id|Should be browsed form the selected spreadsheet key. If you want to create a new file, type in any key that will become the name of the worksheet in the created spreadsheet
|Append to sheet|Appends the lines **without the header** to an existing spreadsheet. This is incompatible with the create option below.
|Create new sheet if it does not exist|If the checkbox is checked then if the Spreadsheet Key specified in the field Spreadsheet key does not exist it will create a new spreadsheet within the service account drive (note that this account has no UI)
|Share Full Rights (RW) with|the Share with user email field lets you specify the email of a user who will get full rights on the freshly created file.
|Domain Wide Permission|Enables to share with your whole domain (if configured in Google Drive).
|===

12 changes: 4 additions & 8 deletions plugins/tech/google/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@
-->
<properties>
<commons-vfs2.version>2.9.0</commons-vfs2.version>
<google-api-sheets.version>v4-rev612-1.25.0</google-api-sheets.version>
<google-api-drive.version>v3-rev197-1.25.0</google-api-drive.version>
<!-- <google-api-services-analytics.version>v3-rev169-1.25.0</google-api-services-analytics.version>-->
<google-api-services-drive.version>v3-rev197-1.25.0</google-api-services-drive.version>
<google-api-sheets.version>v4-rev20230526-2.0.0</google-api-sheets.version>
<!-- <google-api-drive.version>v3-rev197-1.25.0</google-api-drive.version>-->
<google-api-drive.version>v3-rev20230610-2.0.0</google-api-drive.version>
<!-- <google-api-services-drive.version>v3-rev197-1.25.0</google-api-services-drive.version>-->
<jetty-client.version>6.1.26</jetty-client.version>
</properties>

Expand Down Expand Up @@ -97,7 +97,6 @@
</dependency>

<!-- Google Sheets dependencies -->

<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
Expand All @@ -115,7 +114,6 @@
</dependency>

<!-- Google VFS dependencies -->

<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-java6</artifactId>
Expand All @@ -133,15 +131,13 @@
</dependency>

<!-- Google Cloud Storage VFS dependencies -->

<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>${google-cloud-storage.version}</version>
</dependency>

<!-- Test and Hop dependencies -->

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
Loading

0 comments on commit 10b7e50

Please sign in to comment.