Skip to content
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

Google Ads to Postgres type mismatch on ad_group_ad_labels, ad_group_labels and campaign_labels #12096

Closed
Tracked by #11758
b4stien opened this issue Apr 17, 2022 · 9 comments
Assignees
Labels
autoteam community team/connectors-python team/tse Technical Support Engineers type/bug Something isn't working

Comments

@b4stien
Copy link
Contributor

b4stien commented Apr 17, 2022

Postgres seems to be expecting "bigint" for Google Ads ad_group_ad_labels, ad_group_labels and campaign_labels, hence the failure. The relevant log lines are (more below):

2022-04-17 06:07:04 normalization > 06:07:02.037417 [error] [MainThread]: Database Error in model ad_group_ad_labels (models/generated/airbyte_tables/google_ads/ad_group_ad_labels.sql)
2022-04-17 06:07:04 normalization > 06:07:02.037630 [error] [MainThread]:   invalid input syntax for type bigint: "Lp Dep"

I have no idea why #11884 has been closed, it seems to me that the problem still exists.

Environment

  • Airbyte version: 0.35.67-alpha
  • Deployment: Docker
  • Source Connector and version: Google Ads 0.1.34
  • Destination Connector and version: Postgres 0.3.17
  • Severity: Medium
  • Step where error happened: Sync job

Current Behavior

The sync job fails at the normalization phase.

Expected Behavior

The sync job would succeed (and report a success).

Logs

The extract of the end of the logs.

LOG
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.017775 [info ] [MainThread]: Finished running 15 incremental models, 11 table models in 523.18s.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.017993 [debug] [MainThread]: Connection 'master' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018104 [debug] [MainThread]: Connection 'model.airbyte_utils.ad_groups_scd' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018199 [debug] [MainThread]: Connection 'model.airbyte_utils.ad_groups' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018287 [debug] [MainThread]: Connection 'model.airbyte_utils.display_keyword_performance_report' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018361 [debug] [MainThread]: Connection 'model.airbyte_utils.ad_group_ads_stg' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018434 [debug] [MainThread]: Connection 'model.airbyte_utils.ad_group_ad_report' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018507 [debug] [MainThread]: Connection 'model.airbyte_utils.campaigns' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018580 [debug] [MainThread]: Connection 'model.airbyte_utils.ad_group_ads_scd' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.018652 [debug] [MainThread]: Connection 'model.airbyte_utils.ad_group_ads' was properly closed.
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.036674 [info ] [MainThread]: 
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.036897 [info ] [MainThread]: �[31mCompleted with 3 errors and 0 warnings:�[0m
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.037172 [info ] [MainThread]: 
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.037417 [error] [MainThread]: �[33mDatabase Error in model ad_group_ad_labels (models/generated/airbyte_tables/google_ads/ad_group_ad_labels.sql)�[0m
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.037630 [error] [MainThread]:   invalid input syntax for type bigint: "Lp Dep"
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.037885 [error] [MainThread]:   compiled SQL at ../build/run/airbyte_utils/models/generated/airbyte_tables/google_ads/ad_group_ad_labels.sql
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038071 [info ] [MainThread]: 
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038240 [error] [MainThread]: �[33mDatabase Error in model ad_group_labels (models/generated/airbyte_tables/google_ads/ad_group_labels.sql)�[0m
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038393 [error] [MainThread]:   invalid input syntax for type bigint: "Rennes"
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038530 [error] [MainThread]:   compiled SQL at ../build/run/airbyte_utils/models/generated/airbyte_tables/google_ads/ad_group_labels.sql
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038672 [info ] [MainThread]: 
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038809 [error] [MainThread]: �[33mDatabase Error in model campaign_labels (models/generated/airbyte_tables/google_ads/campaign_labels.sql)�[0m
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.038962 [error] [MainThread]:   invalid input syntax for type bigint: "Top campaigns"
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.039099 [error] [MainThread]:   compiled SQL at ../build/run/airbyte_utils/models/generated/airbyte_tables/google_ads/campaign_labels.sql
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.039271 [info ] [MainThread]: 
2022-04-17 06:07:04 �[42mnormalization�[0m > 06:07:02.039414 [info ] [MainThread]: Done. PASS=23 WARN=0 ERROR=3 SKIP=0 TOTAL=26
2022-04-17 06:07:04 �[32mINFO�[m i.a.w.t.TemporalAttemptExecution(lambda$getWorkerThread$2):158 - Completing future exceptionally...
io.airbyte.workers.WorkerException: Normalization Failed.
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:61) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:19) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.TemporalAttemptExecution.lambda$getWorkerThread$2(TemporalAttemptExecution.java:155) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: io.airbyte.workers.WorkerException: Normalization Failed.
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:58) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	... 3 more
	Suppressed: io.airbyte.workers.WorkerException: Normalization process wasn't successful
		at io.airbyte.workers.normalization.DefaultNormalizationRunner.close(DefaultNormalizationRunner.java:160) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:46) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:19) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at io.airbyte.workers.temporal.TemporalAttemptExecution.lambda$getWorkerThread$2(TemporalAttemptExecution.java:155) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at java.lang.Thread.run(Thread.java:833) [?:?]
2022-04-17 06:07:04 �[32mINFO�[m i.a.w.t.TemporalAttemptExecution(get):131 - Stopping cancellation check scheduling...
2022-04-17 06:07:04 �[32mINFO�[m i.a.w.t.TemporalUtils(withBackgroundHeartbeat):235 - Stopping temporal heartbeating...
2022-04-17 06:07:04 �[33mWARN�[m i.t.i.a.POJOActivityTaskHandler(activityFailureToResult):307 - Activity failure. ActivityId=656dc25c-7b37-38b4-8b38-be49ee2ae57b, activityType=Normalize, attempt=1
java.lang.RuntimeException: io.temporal.serviceclient.CheckedExceptionWrapper: java.util.concurrent.ExecutionException: io.airbyte.workers.WorkerException: Normalization Failed.
	at io.airbyte.workers.temporal.TemporalUtils.withBackgroundHeartbeat(TemporalUtils.java:233) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.sync.NormalizationActivityImpl.normalize(NormalizationActivityImpl.java:72) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at jdk.internal.reflect.GeneratedMethodAccessor188.invoke(Unknown Source) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at io.temporal.internal.activity.POJOActivityTaskHandler$POJOActivityInboundCallsInterceptor.execute(POJOActivityTaskHandler.java:214) ~[temporal-sdk-1.8.1.jar:?]
	at io.temporal.internal.activity.POJOActivityTaskHandler$POJOActivityImplementation.execute(POJOActivityTaskHandler.java:180) ~[temporal-sdk-1.8.1.jar:?]
	at io.temporal.internal.activity.POJOActivityTaskHandler.handle(POJOActivityTaskHandler.java:120) ~[temporal-sdk-1.8.1.jar:?]
	at io.temporal.internal.worker.ActivityWorker$TaskHandlerImpl.handle(ActivityWorker.java:204) ~[temporal-sdk-1.8.1.jar:?]
	at io.temporal.internal.worker.ActivityWorker$TaskHandlerImpl.handle(ActivityWorker.java:164) ~[temporal-sdk-1.8.1.jar:?]
	at io.temporal.internal.worker.PollTaskExecutor.lambda$process$0(PollTaskExecutor.java:93) ~[temporal-sdk-1.8.1.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]
Caused by: io.temporal.serviceclient.CheckedExceptionWrapper: java.util.concurrent.ExecutionException: io.airbyte.workers.WorkerException: Normalization Failed.
	at io.temporal.serviceclient.CheckedExceptionWrapper.wrap(CheckedExceptionWrapper.java:56) ~[temporal-serviceclient-1.8.1.jar:?]
	at io.temporal.internal.sync.WorkflowInternal.wrap(WorkflowInternal.java:448) ~[temporal-sdk-1.8.1.jar:?]
	at io.temporal.activity.Activity.wrap(Activity.java:51) ~[temporal-sdk-1.8.1.jar:?]
	at io.airbyte.workers.temporal.TemporalAttemptExecution.get(TemporalAttemptExecution.java:135) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.sync.NormalizationActivityImpl.lambda$normalize$1(NormalizationActivityImpl.java:98) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.TemporalUtils.withBackgroundHeartbeat(TemporalUtils.java:228) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	... 13 more
Caused by: java.util.concurrent.ExecutionException: io.airbyte.workers.WorkerException: Normalization Failed.
	at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) ~[?:?]
	at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) ~[?:?]
	at io.airbyte.workers.temporal.TemporalAttemptExecution.get(TemporalAttemptExecution.java:129) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.sync.NormalizationActivityImpl.lambda$normalize$1(NormalizationActivityImpl.java:98) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.TemporalUtils.withBackgroundHeartbeat(TemporalUtils.java:228) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	... 13 more
Caused by: io.airbyte.workers.WorkerException: Normalization Failed.
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:61) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:19) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.TemporalAttemptExecution.lambda$getWorkerThread$2(TemporalAttemptExecution.java:155) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	... 1 more
Caused by: io.airbyte.workers.WorkerException: Normalization Failed.
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:58) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:19) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	at io.airbyte.workers.temporal.TemporalAttemptExecution.lambda$getWorkerThread$2(TemporalAttemptExecution.java:155) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
	... 1 more
	Suppressed: io.airbyte.workers.WorkerException: Normalization process wasn't successful
		at io.airbyte.workers.normalization.DefaultNormalizationRunner.close(DefaultNormalizationRunner.java:160) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:46) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at io.airbyte.workers.DefaultNormalizationWorker.run(DefaultNormalizationWorker.java:19) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at io.airbyte.workers.temporal.TemporalAttemptExecution.lambda$getWorkerThread$2(TemporalAttemptExecution.java:155) ~[io.airbyte-airbyte-workers-0.35.67-alpha.jar:?]
		at java.lang.Thread.run(Thread.java:833) [?:?]

Steps to Reproduce

Launch a new job with Google Ads as source and Postgres as destination selecting all available streams.

@jagannathsrs
Copy link
Contributor

jagannathsrs commented Apr 19, 2022

We are seeing the same issue with Snowflake as destination

normalization - 2022-04-19 15:27:17 INFO LineGobbler(voidCall):82 - 
normalization - 2022-04-19 15:27:17 INFO LineGobbler(voidCall):82 - Database Error in model CAMPAIGN_LABELS (models/generated/airbyte_tables/ODS_KLOUDIO_GOOGLE_ADS/CAMPAIGN_LABELS.sql)
normalization - 2022-04-19 15:27:17 INFO LineGobbler(voidCall):82 -   100038 (22018): Numeric value 'Old-Brand-Pages' is not recognized
normalization - 2022-04-19 15:27:17 INFO LineGobbler(voidCall):82 -   compiled SQL at ../build/run/airbyte_utils/models/generated/airbyte_tables/ODS_KLOUDIO_GOOGLE_ADS/CAMPAIGN_LABELS.sql

@jagannathsrs
Copy link
Contributor

Update: The broken version is 0.1.30, previous versions work fine.

@davydov-d
Copy link
Collaborator

hi @jagannathsrs
shouldn`t this issue be closed?

@jagannathsrs
Copy link
Contributor

@b4stien can you confirm if the new version is working as expected?

@robby-rob
Copy link

I am still getting a type conversion error on airbyte/source-google-ads:0.1.36. I am not sure if this is specific to the SQL Server dest:

2022-05-06 19:59:07 normalization > ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Error converting data type nvarchar to bigint. (8114) (SQLMoreResults)')
2022-05-06 19:59:07 normalization > 19:59:07 | 1 of 3 ERROR creating table model google_ads.campaign_labels.......................................... [ERROR in 0.33s]

Here is a sample payload from Google Ads for the Ad Group Labels:

{
    "ad_group.resource_name": "customers/1111111111/adGroups/222222222222",
    "ad_group_label.resource_name": "customers/1111111111/adGroupLabels/222222222222~3333333333",
    "label.name": "some_lable_here",
    "label.resource_name": "customers/1111111111/labels/3333333333"
}

It looks like the DBT transformation is still treating the label.name, label.resource_name, and ad_group_ad.ad.resource_name fields as a bigint rather than a (n)varchar causing the error:

create view google_ads."ad_group_ad_labels__dbt_tmp_temp_view" as
    with
        __dbt__cte__ad_group_ad_labels_ab1 as (
            -- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
            -- depends_on: "Raw".google_ads._airbyte_raw_ad_group_ad_labels
            select
                json_value(_airbyte_data, ''$."label.name"'') as "label.name",
                json_value(_airbyte_data, ''$."label.resource_name"'') as "label.resource_name",
                json_value(_airbyte_data, ''$."ad_group_ad.ad.resource_name"'') as "ad_group_ad.ad.resource_name",
                json_value(_airbyte_data, ''$."ad_group_ad_label.resource_name"'') as "ad_group_ad_label.resource_name",
                _airbyte_ab_id,
                _airbyte_emitted_at,
                SYSDATETIME() as _airbyte_normalized_at
            from "Raw".google_ads._airbyte_raw_ad_group_ad_labels as table_alias
            -- ad_group_ad_labels
            where 1 = 1
            ), 

        __dbt__cte__ad_group_ad_labels_ab2 as (
            -- SQL model to cast each column to its adequate SQL type converted from the JSON schema type
            -- depends_on: __dbt__cte__ad_group_ad_labels_ab1
            select
                cast("label.name" as 
                bigint
            ) as "label.name",
                cast("label.resource_name" as 
                bigint
            ) as "label.resource_name",
                cast("ad_group_ad.ad.resource_name" as 
                bigint
            ) as "ad_group_ad.ad.resource_name",
                cast("ad_group_ad_label.resource_name" as 
                VARCHAR(max)) as "ad_group_ad_label.resource_name",
                _airbyte_ab_id,
                _airbyte_emitted_at,
                SYSDATETIME() as _airbyte_normalized_at
            from __dbt__cte__ad_group_ad_labels_ab1
            -- ad_group_ad_labels
            where 1 = 1

As there is no other parsing to get just the numbers, they should be all string types rather than number types.

@davydov-d
Copy link
Collaborator

davydov-d commented May 11, 2022

I am still getting a type conversion error on airbyte/source-google-ads:0.1.36. I am not sure if this is specific to the SQL Server dest:

2022-05-06 19:59:07 normalization > ('42000', '[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Error converting data type nvarchar to bigint. (8114) (SQLMoreResults)')
2022-05-06 19:59:07 normalization > 19:59:07 | 1 of 3 ERROR creating table model google_ads.campaign_labels.......................................... [ERROR in 0.33s]

Here is a sample payload from Google Ads for the Ad Group Labels:

{
    "ad_group.resource_name": "customers/1111111111/adGroups/222222222222",
    "ad_group_label.resource_name": "customers/1111111111/adGroupLabels/222222222222~3333333333",
    "label.name": "some_lable_here",
    "label.resource_name": "customers/1111111111/labels/3333333333"
}

It looks like the DBT transformation is still treating the label.name, label.resource_name, and ad_group_ad.ad.resource_name fields as a bigint rather than a (n)varchar causing the error:

create view google_ads."ad_group_ad_labels__dbt_tmp_temp_view" as
    with
        __dbt__cte__ad_group_ad_labels_ab1 as (
            -- SQL model to parse JSON blob stored in a single column and extract into separated field columns as described by the JSON Schema
            -- depends_on: "Raw".google_ads._airbyte_raw_ad_group_ad_labels
            select
                json_value(_airbyte_data, ''$."label.name"'') as "label.name",
                json_value(_airbyte_data, ''$."label.resource_name"'') as "label.resource_name",
                json_value(_airbyte_data, ''$."ad_group_ad.ad.resource_name"'') as "ad_group_ad.ad.resource_name",
                json_value(_airbyte_data, ''$."ad_group_ad_label.resource_name"'') as "ad_group_ad_label.resource_name",
                _airbyte_ab_id,
                _airbyte_emitted_at,
                SYSDATETIME() as _airbyte_normalized_at
            from "Raw".google_ads._airbyte_raw_ad_group_ad_labels as table_alias
            -- ad_group_ad_labels
            where 1 = 1
            ), 

        __dbt__cte__ad_group_ad_labels_ab2 as (
            -- SQL model to cast each column to its adequate SQL type converted from the JSON schema type
            -- depends_on: __dbt__cte__ad_group_ad_labels_ab1
            select
                cast("label.name" as 
                bigint
            ) as "label.name",
                cast("label.resource_name" as 
                bigint
            ) as "label.resource_name",
                cast("ad_group_ad.ad.resource_name" as 
                bigint
            ) as "ad_group_ad.ad.resource_name",
                cast("ad_group_ad_label.resource_name" as 
                VARCHAR(max)) as "ad_group_ad_label.resource_name",
                _airbyte_ab_id,
                _airbyte_emitted_at,
                SYSDATETIME() as _airbyte_normalized_at
            from __dbt__cte__ad_group_ad_labels_ab1
            -- ad_group_ad_labels
            where 1 = 1

As there is no other parsing to get just the numbers, they should be all string types rather than number types.

@robby-rob have you tried refreshing the schema?

@robby-rob
Copy link

@davydov-d Yep that fixed the issue!

@davydov-d
Copy link
Collaborator

@davydov-d Yep that fixed the issue!

great, so I'm closing this issue. Thanks for cooperation

@b4stien
Copy link
Contributor Author

b4stien commented May 11, 2022

I can confirm: it fixed the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autoteam community team/connectors-python team/tse Technical Support Engineers type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants