I have a connection using TikTok Marketing as a so...
# replication-troubleshooting
j
I have a connection using TikTok Marketing as a source and BigQuery as a destination. I'm pulling the
ads_reports_daily
stream, which according to the connector docs:
For example, if you select the daily-aggregation flavor of a report, the report will contain a row for each day for the duration of the report. Each row will indicate the number of impressions recorded on that day.
My issue is that in the destination dataset, I'm only seeing data for that day of each ad. (If I ran a sync yesterday, I can only see the yesterday's clicks/impressions/conversions. If I run a sync again today, yesterday's data is deleted and I start seeing only today's values.) I suspect this behavior is caused by the sync mode, which is set to "Incremental | Deduped + history", with
stat_time_day
as cursor and
ad_id
as primary key. But: 1.
stat_time_day
aren't suposed to be a primary key too? So the transformation can keep one entry for each day AND ad_id? 2. If I change the sync mode to "Incremental | Append", my problem is solved (kind of), but then I would make room for duplicates and missing data (days skipped due to errors or unavailability) 3. My guess is that for what I need, the "Incremental | *Deduped + history*" should work, but then I would need to set the
stat_time_day
as the primary key as well, which seems to be impossible, since this field cannot be changed in the connector replication settings. Any tips or anyone in the same situation? Thanks in advance.
n
Hi, @José Lúcio Zancan Júnior! 1. No, the cursor field is not the same as the primary key. The cursor field is used in Incremental sync mode to determine which records to sync, while the primary key is used in Incremental Deduped History sync mode to determine the unique identifier. 2. You should be able to set a custom primary key for BigQuery destination. To do this, you need to configure the BigQuery destination connector using the Airbyte UI. In the configuration, you will need to specify the
primary_key
field. Can you send a screenshot of your UI where you're trying to set the custom primary key?
r
Hi @Nataly Merezhuk (Airbyte) 👋 I am encountering the exact same problem as @José Lúcio Zancan Júnior. Actually the logic he is describing is very common in "reports" API and usually there should be a composite primary key to have a correct "Incremental | Deduped + History" sync. This logic is implemented in Snapchat Marketing Source, BingAds (cf picture) or even Facebook Marketing for instance
But when we take a look at TikTok Marketing, it's not the case, which is a problem indeed as it is no deduplicating as expected for this kind of connector. I was going to create an issue about it, to align it with what exists for other similar source connectors I mentioned
🎯 1
j
That's exactly my problem. Even the screenshots are identical
👍 1
r
Here's the issue opened by @Matthieu COLIN: https://github.com/airbytehq/airbyte/issues/23728
n
I see, thanks for all the info @Rachel RIZK. In the issue the user is on an older version of Airbyte. What version are you on and can you update?
r
Thanks @Nataly Merezhuk (Airbyte). On my side when spinning a new Airbyte instance (latest version) it's the same problem. This is related to the source connector (no matter the destination) as primary key is defined within its code. There is no problem in very similar source connectors (Snapchat, Facebook Marketing, Bing Ads) as their primary key is correctly defined in their code source (composite primary key, ie a mix of different columns, versus simple primary key in TikTok)