Vitor Fortunato
11/06/2024, 9:25 AM400 Client Error: Bad Request for path: /v16/customers:listAccessibleCustomers
• singer variant:
◦ fails with: key error: tap-google-ads.api-field-names
considerations:
• We've recently received approval from Google for a Basic Acess developer_token (which can query production accounts) and I am able to use purely Google Ads python SDK with python and get campaigns with this sample.
• in the thread, I will post details of my meltano configs for attempting to ingest data with both taps
What am I doing wrong?Vitor Fortunato
11/06/2024, 9:26 AM- name: tap-googleads
variant: matatika
pip_url: git+<https://github.com/Matatika/tap-googleads.git@v0.5.0>
config:
customer_id: XXX-XXX-XXXX # (as seen in Google Ads account)
developer_token: "xxx"
oauth_credentials:
client_id: "xxx"
client_secret: "xxx"
token_uri: <https://oauth2.googleapis.com/token>
auth_uri: <https://accounts.google.com/o/oauth2/auth>
refresh_token: "xxx"
type: authorized_user
singer variant:
- name: tap-googleads
variant: singer-io
pip_url: git+<https://github.com/singer-io/tap-google-ads.git>
config:
start_date: 2024-10-01T00:00:00Z
customer_ids: XXXXXXXXXX # taken from google ads account but no hyphens
login_customer_ids:
- customerId: XXXXXXXXXX # taken from google ads account but no hyphens
loginCustomerId: XXXXXXXXXX # taken from google ads account but no hyphens
developer_token: "xxx"
oauth_client_id: "xxx"
oauth_client_secret: "xxx"
refresh_token: "xxx"
Reuben (Matatika)
11/06/2024, 9:30 AMlogin_customer_id
. https://github.com/Matatika/tap-googleads?tab=readme-ov-file#login_customer_idVitor Fortunato
11/06/2024, 9:32 AMReuben (Matatika)
11/06/2024, 9:35 AMrefresh_token
credential you are providing may pertain to a manager account, so you would need to provide login_customer_id
in that case.Reuben (Matatika)
11/06/2024, 9:35 AMVitor Fortunato
11/06/2024, 9:41 AMlogin_customer_id: XXX-XXX-XXXX # (manager account id / MCC)
customer_ids: XXX-XXX-XXXX # (sub-account id)
results in the same error 400 Client Error: Bad Request for path: /v16/customers:listAccessibleCustomers
-----
but let me double-check the refresh token I have, because it might not match with the manager account, if that's a potential issueVitor Fortunato
11/06/2024, 9:44 AMReuben (Matatika)
11/06/2024, 9:49 AMcustomer_id
? They need to be omitted, as in the SInger variant. https://github.com/Matatika/tap-googleads?tab=readme-ov-file#customer_idscustomer_idReuben (Matatika)
11/06/2024, 9:53 AMVitor Fortunato
11/06/2024, 9:57 AMReuben (Matatika)
11/06/2024, 10:02 AMlogin_customer_id
again if you want. 😄Reuben (Matatika)
11/06/2024, 10:02 AMmeltano add --update tap-googleads
FYI the v16
API the current version of the tap you are running with uses is due to be sunset in Feb next year: https://developers.google.com/google-ads/api/docs/sunset-datesVitor Fortunato
11/06/2024, 10:05 AMmeltano add extractor tap-googleads
Reuben (Matatika)
11/06/2024, 10:08 AMVitor Fortunato
11/08/2024, 1:06 PMsinger_sdk.exceptions.MissingKeyPropertiesError: Record is missing one or more key_properties.
Key Properties: ['resource_names'], Record Keys: ['resourceNames']
I know data is coming like:
{
"resourceNames": [
"customers/xx",
"customers/xxx"
]
}
any workaround that I can apply here?Reuben (Matatika)
11/08/2024, 2:08 PMconfig:
stream_maps:
stream_accessible_customers:
resource_names: resourceNames
resourceNames: __NULL__
https://sdk.meltano.com/en/latest/stream_maps.html#aliasing-properties
You may have to do this for other streams that define using snake-case. Additionally, some streams also have an implied dependency on flattening enabled to form the primary key from nested properties (indicated by a double underscore __
), so you may have to apply flattening and then define some more mappings as above for the time being.Reuben (Matatika)
11/08/2024, 2:30 PMVitor Fortunato
11/08/2024, 2:34 PMKlaus Rubenstein
11/08/2024, 10:04 PM2024-11-08T21:58:33.116338Z [info ] raise MissingKeyPropertiesError( cmd_type=elb consumer=True job_name=dev:tap-googleads-to-target-postgres name=target-postgres producer=False run_id=60201b9b-63c9-4048-a146-3872a6d6278b stdio=stderr string_id=target-postgres
2024-11-08T21:58:33.116534Z [info ] singer_sdk.exceptions.MissingKeyPropertiesError: Record is missing one or more key_properties. cmd_type=elb consumer=True job_name=dev:tap-googleads-to-target-postgres name=target-postgres producer=False run_id=60201b9b-63c9-4048-a146-3872a6d6278b stdio=stderr string_id=target-postgres
2024-11-08T21:58:33.117009Z [info ] Key Properties: ['campaign__id'], Record Keys: ['campaign', 'customer_id', '_sdc_extracted_at', '_sdc_received_at', '_sdc_batched_at', '_sdc_deleted_at', '_sdc_sequence', '_sdc_table_version', '_sdc_sync_started_at'] cmd_type=elb consumer=True job_name=dev:tap-googleads-to-target-postgres name=target-postgres producer=False run_id=60201b9b-63c9-4048-a146-3872a6d6278b stdio=stderr string_id=target-postgres
The job will stops with "Loader failed".Reuben (Matatika)
11/08/2024, 10:20 PMpip_url: git+<https://github.com/Matatika/tap-googleads.git@|https://github.com/Matatika/tap-googleads.git@>5-primary-keys-format
Klaus Rubenstein
11/09/2024, 7:22 AMKlaus Rubenstein
11/10/2024, 7:37 PMNotImplementedError: Altering columns is not supported. Could not convert column 'tap_googleads.stream_accessible_customers.resourceNames' from 'JSONB' to 'TEXT'.
Reuben (Matatika)
11/11/2024, 11:31 AMmeltano.yml
? What happens if you drop the stream_accessible_customers
table and let the target recreate it?Vitor Fortunato
11/11/2024, 2:39 PM"WARNING", "message": "Unable to find a config for key_properties - stream_accessible_customers",
• and then, a bunch of errors like:
"ERROR", "message": "Error while processing stream_campaign: 000904 (42000): SQL compilation error: error line 3 at position 52\ninvalid identifier 'CAMPAIGN__ID'"
"ERROR", "message": "Error while processing stream_adgroupsperformance: 000904 (42000): SQL compilation error: error line 3 at position 52\ninvalid identifier 'CAMPAIGN__ID'"
"ERROR", "message": "Error while processing stream_adgroups: 000904 (42000): SQL compilation error: error line 3 at position 52\ninvalid identifier 'ADGROUP__ID'"
"ERROR", "message": "Error while processing stream_campaign_performance: 000904 (42000): SQL compilation error: error line 3 at position 52\ninvalid identifier 'CAMPAIGN__NAME'"
"ERROR", "message": "Error while processing stream_customer_hierarchy: 000904 (42000): SQL compilation error: error line 3 at position 52\ninvalid identifier 'CUSTOMERCLIENT__ID'"
Reuben (Matatika)
11/11/2024, 2:43 PMmeltano.yml
please? What target-s3
are you using (unclear why SQL is involved here)?Vitor Fortunato
11/11/2024, 2:49 PMVitor Fortunato
11/11/2024, 2:49 PMReuben (Matatika)
11/11/2024, 2:50 PMKlaus Rubenstein
11/12/2024, 9:36 AMstream_accessible_customers
table was the solution! Thanks for your time Reuben, will check the data now but looks fine so far! :)Vitor Fortunato
11/12/2024, 10:40 AMReuben (Matatika)
11/12/2024, 11:40 AMconfig:
stream_maps:
'*':
__key_properties__: __NULL__
but then rows will only be appended rather than updated, so you will inevitably get duplicate data.
https://sdk.meltano.com/en/v0.42.1/stream_maps.html#unset-or-modify-the-stream-s-primary-key-behaviorReuben (Matatika)
11/12/2024, 11:57 AMVitor Fortunato
11/12/2024, 2:51 PMmeltano invoke tap-googleads --discover
to get the schema, it will still come with unflattened fields. This is a problem to us because we use this schema to run s3 to snowflake copyReuben (Matatika)
11/12/2024, 3:07 PMmeltano run tap-googleads target-snowflake
will respect the flattening. Why are you loading to S3 first? For bulk loading?
@Edgar Ramírez (Arch.dev) Should the schema from --discover
respect flattening_enabled
here (and potentially other mappings)?Vitor Fortunato
11/12/2024, 3:08 PMReuben (Matatika)
11/12/2024, 3:11 PMtarget-snowflake
runs a bulk load from the local file-system, so you shouldn't need the intermediate S3 layer if you're concerned about speed.Edgar Ramírez (Arch.dev)
11/12/2024, 3:14 PM@Edgar Ramírez (Arch.dev) Should the schema fromrespect--discover
here (and potentially other mappings)?flattening_enabled
It doesn't at the moment. The
SCHEMA
messages would be the source of truth for the emitted records.Edgar Ramírez (Arch.dev)
11/12/2024, 3:42 PM