diff --git a/airbyte-integrations/connectors/source-facebook-marketing/AGENTS.md b/airbyte-integrations/connectors/source-facebook-marketing/AGENTS.md
new file mode 100644
index 000000000000..7151829ebe80
--- /dev/null
+++ b/airbyte-integrations/connectors/source-facebook-marketing/AGENTS.md
@@ -0,0 +1,17 @@
+> NOTE: CLAUDE.md is a symlink to AGENTS.md; update AGENTS.md (not the symlink) when changing these instructions.
+
+# Contributing to source-facebook-marketing
+
+For general guidance on contributing to Airbyte connectors, see the [Connector Development documentation](https://docs.airbyte.com/connector-development/).
+
+## Incremental Stream Considerations
+
+The Facebook Marketing API supports date-based filtering via `time_range` and `filtering` parameters. The connector is a Python CDK connector with classes like `FBMarketingIncrementalStream` and `FBMarketingReversedIncrementalStream` providing incremental patterns.
+
+**Connector type:** Python CDK
+
+**Analysis status:** Pure Python CDK connector with sophisticated incremental patterns already in place. Full stream-by-stream analysis requires Python code review.
+
+### Future incremental stream candidates
+
+- **All streams deferred for Python code review:** This connector defines its streams in Python code rather than declarative manifest YAML. A full stream-by-stream incremental analysis table (per the standard CONTRIBUTING.md schema) should be added by a future agent after reviewing the Python stream definitions, their `cursor_field` properties, and the API endpoints they call.
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/CLAUDE.md b/airbyte-integrations/connectors/source-facebook-marketing/CLAUDE.md
new file mode 120000
index 000000000000..47dc3e3d863c
--- /dev/null
+++ b/airbyte-integrations/connectors/source-facebook-marketing/CLAUDE.md
@@ -0,0 +1 @@
+AGENTS.md
\ No newline at end of file
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/acceptance-test-config.yml b/airbyte-integrations/connectors/source-facebook-marketing/acceptance-test-config.yml
index 233dcd0241d1..88610bab11b2 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/acceptance-test-config.yml
+++ b/airbyte-integrations/connectors/source-facebook-marketing/acceptance-test-config.yml
@@ -28,22 +28,50 @@ acceptance_tests:
bypass_reason: "Data cannot be seeded in the test account, integration tests added for the stream instead"
- name: "videos"
bypass_reason: "Data cannot be seeded in the test account, integration tests added for the stream instead"
- timeout_seconds: 4800
- expect_records:
- path: "integration_tests/expected_records.jsonl"
+ - name: "ads_insights"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_action_type"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_age_and_gender"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_comscore_market"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_country"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_platform_and_device"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_region"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_action_carousel_card"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_action_conversion_device"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_action_reaction"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_action_video_sound"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_action_video_type"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_delivery_device"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_delivery_platform"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_delivery_platform_and_device_platform"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_demographics_age"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_demographics_comscore_market_region"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_demographics_country"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "ads_insights_demographics_gender"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
+ - name: "customcustom_insight_stream"
+ bypass_reason: "The test ad accounts have never delivered an ad (lifetime spend 0), so Meta returns no insights rows in any window; needs a running campaign in the test account"
incremental:
tests:
- config_path: "secrets/config.json"
- timeout_seconds: 6000
future_state:
future_state_path: "integration_tests/future_state.json"
# ads_insights is currently failing because there is a lookback window and the minimum value is one day
skip_comprehensive_incremental_tests: true
- full_refresh:
- tests:
- - config_path: "secrets/config.json"
- timeout_seconds: 4800
- ignored_fields:
- activities:
- - name: extra_data
- bypass_reason: "image_url in extra_data is changing frequently"
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/ads_insights_configured_catalog.json b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/ads_insights_configured_catalog.json
index 213268e4eea0..d34a9bbc102a 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/ads_insights_configured_catalog.json
+++ b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/ads_insights_configured_catalog.json
@@ -119,7 +119,7 @@
},
{
"stream": {
- "name": "ads_insights_demographics_dma_region",
+ "name": "ads_insights_demographics_comscore_market_region",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"]
},
@@ -137,7 +137,7 @@
},
{
"stream": {
- "name": "ads_insights_dma",
+ "name": "ads_insights_comscore_market",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"]
},
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/configured_catalog.json b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/configured_catalog.json
index 651412dbaf73..64e0d5745086 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/configured_catalog.json
+++ b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/configured_catalog.json
@@ -36,6 +36,15 @@
"sync_mode": "full_refresh",
"destination_sync_mode": "append"
},
+ {
+ "stream": {
+ "name": "ad_creatives_from_ads",
+ "json_schema": {},
+ "supported_sync_modes": ["full_refresh", "incremental"]
+ },
+ "sync_mode": "incremental",
+ "destination_sync_mode": "append"
+ },
{
"stream": {
"name": "ads_insights",
@@ -74,7 +83,7 @@
},
{
"stream": {
- "name": "ads_insights_dma",
+ "name": "ads_insights_comscore_market",
"json_schema": {},
"supported_sync_modes": ["full_refresh", "incremental"]
},
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/future_state.json b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/future_state.json
index e8b8217c3a11..524e289f7dbb 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/future_state.json
+++ b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/future_state.json
@@ -59,6 +59,18 @@
}
}
},
+ {
+ "type": "STREAM",
+ "stream": {
+ "stream_state": {
+ "updated_time": "2121-07-25",
+ "filter_statuses": ["ARCHIVED"]
+ },
+ "stream_descriptor": {
+ "name": "ad_creatives_from_ads"
+ }
+ }
+ },
{
"type": "STREAM",
"stream": {
@@ -131,7 +143,7 @@
"filter_statuses": []
},
"stream_descriptor": {
- "name": "ads_insights_dma"
+ "name": "ads_insights_comscore_market"
}
}
},
@@ -323,7 +335,7 @@
"filter_statuses": []
},
"stream_descriptor": {
- "name": "ads_insights_demographics_dma_region"
+ "name": "ads_insights_demographics_comscore_market_region"
}
}
},
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/spec.json b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/spec.json
index d9c2631a1bb5..fbb70b67e975 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/spec.json
+++ b/airbyte-integrations/connectors/source-facebook-marketing/integration_tests/spec.json
@@ -21,9 +21,10 @@
},
"access_token": {
"title": "Access Token",
- "description": "The value of the generated access token. From your App’s Dashboard, click on \"Marketing API\" then \"Tools\". Select permissions ads_management, ads_read, read_insights, business_management. Then click on \"Get token\". See the docs for more information.",
+ "description": "The value of the generated access token. We recommend a Meta system user access token: in Meta Business Settings, go to Users > System users, assign your ad account(s) to the system user, then click Generate new token for your app and select the ads_read, ads_management, and business_management permissions. See the docs for more information.",
"order": 1,
"airbyte_secret": true,
+ "airbyte_hidden": true,
"type": "string"
},
"credentials": {
@@ -56,7 +57,7 @@
},
"access_token": {
"title": "Access Token",
- "description": "The value of the generated access token. From your App’s Dashboard, click on \"Marketing API\" then \"Tools\". Select permissions ads_management, ads_read, read_insights, business_management. Then click on \"Get token\". See the docs for more information.",
+ "description": "The value of the generated access token. We recommend a Meta system user access token: in Meta Business Settings, go to Users > System users, assign your ad account(s) to the system user, then click Generate new token for your app and select the ads_read, ads_management, and business_management permissions. See the docs for more information.",
"airbyte_secret": true,
"type": "string"
}
@@ -76,7 +77,7 @@
},
"access_token": {
"title": "Access Token",
- "description": "The value of the generated access token. From your App’s Dashboard, click on \"Marketing API\" then \"Tools\". Select permissions ads_management, ads_read, read_insights, business_management. Then click on \"Get token\". See the docs for more information.",
+ "description": "The value of the generated access token. We recommend a Meta system user access token: in Meta Business Settings, go to Users > System users, assign your ad account(s) to the system user, then click Generate new token for your app and select the ads_read, ads_management, and business_management permissions. See the docs for more information.",
"airbyte_secret": true,
"type": "string"
}
@@ -87,7 +88,7 @@
},
"start_date": {
"title": "Start Date",
- "description": "The date from which you'd like to replicate data for all incremental streams, in the format YYYY-MM-DDT00:00:00Z. If not set then all data will be replicated for usual streams and only last 2 years for insight streams.",
+ "description": "The date from which you'd like to replicate data for all incremental streams, in the format YYYY-MM-DDT00:00:00Z. If not set then all data will be replicated for usual streams and only last 37 months for insight streams.",
"order": 2,
"pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$",
"examples": ["2017-01-25T00:00:00Z"],
@@ -457,7 +458,6 @@
"creative_relaxation_asset_type",
"description_asset",
"device_platform",
- "dma",
"fidelity_type",
"flexible_format_asset_type",
"frequency_value",
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/metadata.yaml b/airbyte-integrations/connectors/source-facebook-marketing/metadata.yaml
index d86a002efe1e..d61478c73afb 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/metadata.yaml
+++ b/airbyte-integrations/connectors/source-facebook-marketing/metadata.yaml
@@ -6,19 +6,26 @@ data:
hosts:
- graph.facebook.com
connectorBuildOptions:
- baseImage: docker.io/airbyte/python-connector-base:4.0.2@sha256:9fdb1888c4264cf6fee473649ecb593f56f58e5d0096a87ee0b231777e2e3e73
+ baseImage: docker.io/airbyte/python-connector-base:4.1.1@sha256:a268b44c733ae699a60f5fbc06a324945dba98945c6e2ab7f8609f2f895b0d28
connectorSubtype: api
connectorType: source
definitionId: e7778cfc-e97c-4458-9ecb-b4f2bba8946c
- dockerImageTag: 5.3.1
+ dockerImageTag: 6.2.0
dockerRepository: airbyte/source-facebook-marketing
documentationUrl: https://docs.airbyte.com/integrations/sources/facebook-marketing
externalDocumentationUrls:
- title: Changelog
url: https://developers.facebook.com/docs/marketing-api/marketing-api-changelog
type: api_release_history
- - title: 2025 Out-Of-Cycle Changes
- url: https://developers.facebook.com/docs/marketing-api/out-of-cycle-changes/occ-2025
+ - title: 2026 Out-Of-Cycle Changes
+ url: https://developers.facebook.com/documentation/ads-commerce/marketing-api/out-of-cycle-changes/occ-2026
+ type: api_deprecations
+ - title: Marketing API Versioning
+ url: https://developers.facebook.com/docs/marketing-api/versions
+ type: api_deprecations
+ - title: Marketing API Authorization
+ url: https://developers.facebook.com/docs/marketing-api/access
+ type: authentication_guide
- title: API Upgrade Tool
url: https://developers.facebook.com/tools/api_versioning/600551260845577/
type: api_reference
@@ -43,7 +50,12 @@ data:
releaseStage: generally_available
releases:
rolloutConfiguration:
- enableProgressiveRollout: false
+ enableProgressiveRollout: true
+ defaultRolloutMode: autopilot
+ autopilotConfig:
+ autoStart: true
+ autoPromoteStages: true
+ strategy: slow
breakingChanges:
2.0.0:
message: "All Ads-Insights-* streams now have updated schemas. Users will need to retest source configuration, refresh the source schema and reset affected streams after upgrading. Please pay attention that data older than 37 months will become unavailable due to FaceBook limitations. For more information [visit](https://docs.airbyte.com/integrations/sources/facebook-marketing-migrations)"
@@ -72,6 +84,10 @@ data:
- scopeType: stream
impactedScopes:
- "ad_creatives"
+ 6.0.0:
+ message: "Meta deprecated the `dma` (Nielsen DMA) breakdown effective June 22, 2026, replacing it with `comscore_market`. The built-in `ads_insights_dma` and `ads_insights_demographics_dma_region` streams have been replaced with `ads_insights_comscore_market` and `ads_insights_demographics_comscore_market_region`. Users syncing the old DMA streams must switch to the new Comscore Market streams. The `dma` breakdown has also been removed from Custom Insights configuration. For more information, see the [migration guide](https://docs.airbyte.com/integrations/sources/facebook-marketing-migrations)."
+ upgradeDeadline: "2026-06-24"
+ deadlineAction: "auto_upgrade"
5.0.0:
message: "This update includes multiple breaking schema changes: (1) Custom Insights streams now use level-based primary keys — when `level` is set to `adset`, `campaign`, or `account`, the primary key will use `adset_id`, `campaign_id`, or just `account_id` respectively, instead of always using `ad_id`. (2) The deprecated `7d_view` and `28d_view` attribution window columns have been removed from all Ads Insights streams, as Meta stopped returning data for these windows on January 12, 2026. (3) The `wish_bid` field has been removed from Ads Insights streams. All users should refresh their source schema and reset affected streams after upgrading. For more information, see the [migration guide](https://docs.airbyte.com/integrations/sources/facebook-marketing-migrations)."
upgradeDeadline: "2026-04-10"
@@ -89,7 +105,7 @@ data:
- ads_insights_country
- ads_insights_platform_and_device
- ads_insights_region
- - ads_insights_dma
+ - ads_insights_comscore_market
- activities
supportLevel: certified
tags:
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/poetry.lock b/airbyte-integrations/connectors/source-facebook-marketing/poetry.lock
index 8e4c5986875a..80188ac6600f 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/poetry.lock
+++ b/airbyte-integrations/connectors/source-facebook-marketing/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.8.5 and should not be changed by hand.
+# This file is automatically @generated by Poetry 2.5.1 and should not be changed by hand.
[[package]]
name = "aiohappyeyeballs"
@@ -6,6 +6,7 @@ version = "2.6.1"
description = "Happy Eyeballs for asyncio"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "aiohappyeyeballs-2.6.1-py3-none-any.whl", hash = "sha256:f349ba8f4b75cb25c99c5c2d84e997e485204d2902a9597802b0371f09331fb8"},
{file = "aiohappyeyeballs-2.6.1.tar.gz", hash = "sha256:c3f9d0113123803ccadfdf3f0faa505bc78e6a72d1cc4806cbd719826e943558"},
@@ -17,6 +18,7 @@ version = "3.13.5"
description = "Async http client/server framework (asyncio)"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "aiohttp-3.13.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:02222e7e233295f40e011c1b00e3b0bd451f22cf853a0304c3595633ee47da4b"},
{file = "aiohttp-3.13.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:bace460460ed20614fa6bc8cb09966c0b8517b8c58ad8046828c6078d25333b5"},
@@ -143,7 +145,6 @@ files = [
[package.dependencies]
aiohappyeyeballs = ">=2.5.0"
aiosignal = ">=1.4.0"
-async-timeout = {version = ">=4.0,<6.0", markers = "python_version < \"3.11\""}
attrs = ">=17.3.0"
frozenlist = ">=1.1.1"
multidict = ">=4.5,<7.0"
@@ -151,7 +152,7 @@ propcache = ">=0.2.0"
yarl = ">=1.17.0,<2.0"
[package.extras]
-speedups = ["Brotli (>=1.2)", "aiodns (>=3.3.0)", "backports.zstd", "brotlicffi (>=1.2)"]
+speedups = ["Brotli (>=1.2) ; platform_python_implementation == \"CPython\"", "aiodns (>=3.3.0)", "backports.zstd ; platform_python_implementation == \"CPython\" and python_version < \"3.14\"", "brotlicffi (>=1.2) ; platform_python_implementation != \"CPython\""]
[[package]]
name = "aiosignal"
@@ -159,6 +160,7 @@ version = "1.4.0"
description = "aiosignal: a list of registered asynchronous callbacks"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "aiosignal-1.4.0-py3-none-any.whl", hash = "sha256:053243f8b92b990551949e63930a839ff0cf0b0ebbe0597b0f3fb19e1a0fe82e"},
{file = "aiosignal-1.4.0.tar.gz", hash = "sha256:f47eecd9468083c2029cc99945502cb7708b082c232f9aca65da147157b251c7"},
@@ -170,13 +172,14 @@ typing-extensions = {version = ">=4.2", markers = "python_version < \"3.13\""}
[[package]]
name = "airbyte-cdk"
-version = "7.17.4"
+version = "7.45.1"
description = "A framework for writing Airbyte Connectors."
optional = false
-python-versions = "<3.14,>=3.10"
+python-versions = "<3.15,>=3.10"
+groups = ["main"]
files = [
- {file = "airbyte_cdk-7.17.4-py3-none-any.whl", hash = "sha256:03bf0d58fafe1a7a106b97f0fed2e5fd9f61c21fed5ff0bae5d7c22df4a68794"},
- {file = "airbyte_cdk-7.17.4.tar.gz", hash = "sha256:875b8846ddf12f4bc80e192b976270fd06606eebb5b1c58e60a1114a6ef137d7"},
+ {file = "airbyte_cdk-7.45.1-py3-none-any.whl", hash = "sha256:912ef3a7973ed6f2552689580d1c13f427bed30c4436a10208db1af78ed54a26"},
+ {file = "airbyte_cdk-7.45.1.tar.gz", hash = "sha256:500b457927f7c1fd5a2c58272e7ec6477e5ebdf5e019d3e5064d132749a26f2b"},
]
[package.dependencies]
@@ -186,26 +189,27 @@ backoff = "*"
boltons = ">=25.0.0,<26.0.0"
cachetools = "*"
click = ">=8.1.8,<9.0.0"
-cryptography = ">=44.0.0,<45.0.0"
+cryptography = ">=44.0.0,!=45.0.0,!=45.0.1"
dateparser = ">=1.2.2,<2.0.0"
dpath = ">=2.1.6,<3.0.0"
dunamai = ">=1.22.0,<2.0.0"
genson = "1.3.0"
google-cloud-secret-manager = ">=2.17.0,<3.0.0"
+ijson = ">=3.3.0,<4.0.0"
isodate = ">=0.6.1,<0.7.0"
Jinja2 = ">=3.1.2,<3.2.0"
jsonref = ">=1,<2"
jsonschema = ">=4.17.3,<5.0"
-nltk = "3.9.1"
+nltk = "3.9.4"
orjson = ">=3.10.7,<4.0.0"
packaging = "*"
-pandas = "2.2.3"
-pydantic = ">=2.7,<3.0"
+pandas = ">=2.2.3,<3.0"
+pydantic = ">=2.13,<3.0"
pyjwt = ">=2.8.0,<3.0.0"
pyrate-limiter = ">=3.1.0,<3.2.0"
python-dateutil = ">=2.9.0,<3.0.0"
python-ulid = ">=3.0.0,<4.0.0"
-pytz = "2024.2"
+pytz = ">=2024.2"
PyYAML = ">=6.0.1,<7.0.0"
rapidfuzz = ">=3.10.1,<4.0.0"
referencing = ">=0.36.2"
@@ -214,19 +218,20 @@ requests_cache = "*"
rich = "*"
rich-click = ">=1.8.8,<2.0.0"
serpyco-rs = ">=1.10.2,<2.0.0"
-setuptools = ">=80.9.0,<81.0.0"
+setuptools = ">=80.9.0"
typing-extensions = "*"
unidecode = ">=1.3.8,<2.0.0"
+urllib3 = "*"
wcmatch = "10.0"
whenever = ">=0.7.3,<0.9.0"
xmltodict = ">=0.13,<0.15"
[package.extras]
dev = ["pytest (>=7,<8)"]
-file-based = ["avro (>=1.11.2,<1.13.0)", "fastavro (>=1.11.0,<2.0.0)", "markdown", "openpyxl (>=3.1.0,<4.0.0)", "pdf2image (==1.16.3)", "pdfminer.six (==20221105)", "pyarrow (>=19.0.0,<20.0.0)", "pytesseract (==0.3.10)", "python-calamine (==0.2.3)", "python-snappy (==0.7.3)", "unstructured.pytesseract (>=0.3.12)", "unstructured[docx,pptx] (==0.10.27)"]
+file-based = ["avro (>=1.11.2,<1.13.0)", "fastavro (>=1.11.0,<2.0.0)", "markdown", "openpyxl (>=3.1.0,<4.0.0)", "pdf2image (==1.16.3)", "pdfminer.six (==20221105)", "pyarrow (>=19.0.0,<24.0.0)", "pytesseract (==0.3.10)", "python-calamine (>=0.2.3,<0.9.0)", "python-snappy (==0.7.3)", "unstructured.pytesseract (>=0.3.12)", "unstructured[docx,pptx] (==0.10.27)"]
manifest-server = ["ddtrace (>=3,<4)", "fastapi (>=0.116.1)", "uvicorn (>=0.35.0)"]
sql = ["sqlalchemy (>=2.0,!=2.0.36,<3.0)"]
-vector-db-based = ["cohere (>=4.21,<6.0.0)", "langchain_community (>=0.4,<0.5)", "langchain_core (>=1.2.5,<2.0.0)", "langchain_text_splitters (>=1.0.0,<2.0.0)", "openai[embeddings] (==0.27.9)", "tiktoken (==0.8.0)"]
+vector-db-based = ["cohere (>=4.21,<6.0.0)", "langchain_community (>=0.4,<0.5)", "langchain_core (>=1.2.5,<2.0.0)", "langchain_text_splitters (>=1.0.0,<2.0.0)", "openai[embeddings] (==0.27.9)", "tiktoken (>=0.8.0,<0.15.0)"]
[[package]]
name = "airbyte-protocol-models-dataclasses"
@@ -234,6 +239,7 @@ version = "0.17.1"
description = "Declares the Airbyte Protocol using Python Dataclasses. Dataclasses in Python have less performance overhead compared to Pydantic models, making them a more efficient choice for scenarios where speed and memory usage are critical"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "airbyte_protocol_models_dataclasses-0.17.1-py3-none-any.whl", hash = "sha256:ef83ac56de6208afe0a21ce05bcfbcfc98b98300a76fb3cdf4db2e7f720f1df0"},
{file = "airbyte_protocol_models_dataclasses-0.17.1.tar.gz", hash = "sha256:cbccfdf84fabd0b6e325cc57fa0682ae9d386fce8fcb5943faa5df2b7e599919"},
@@ -245,6 +251,7 @@ version = "0.7.0"
description = "Reusable constraint types to use with typing.Annotated"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53"},
{file = "annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89"},
@@ -256,28 +263,19 @@ version = "0.3.3"
description = "Unicode to ASCII transliteration"
optional = false
python-versions = ">=3.3"
+groups = ["main"]
files = [
{file = "anyascii-0.3.3-py3-none-any.whl", hash = "sha256:f5ab5e53c8781a36b5a40e1296a0eeda2f48c649ef10c3921c1381b1d00dee7a"},
{file = "anyascii-0.3.3.tar.gz", hash = "sha256:c94e9dd9d47b3d9494eca305fef9447d00b4bf1a32aff85aa746fa3ec7fb95c3"},
]
-[[package]]
-name = "async-timeout"
-version = "5.0.1"
-description = "Timeout context manager for asyncio programs"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "async_timeout-5.0.1-py3-none-any.whl", hash = "sha256:39e3809566ff85354557ec2398b55e096c8364bacac9405a7a1fa429e77fe76c"},
- {file = "async_timeout-5.0.1.tar.gz", hash = "sha256:d9321a7a3d5a6a5e187e824d2fa0793ce379a202935782d555d6e9d2735677d3"},
-]
-
[[package]]
name = "attributes-doc"
version = "0.4.0"
description = "PEP 224 implementation"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "attributes-doc-0.4.0.tar.gz", hash = "sha256:b1576c94a714e9fc2c65c47cf10d0c8e1a5f7c4f5ae7f69006be108d95cbfbfb"},
{file = "attributes_doc-0.4.0-py2.py3-none-any.whl", hash = "sha256:4c3007d9e58f3a6cb4b9c614c4d4ce2d92161581f28e594ddd8241cc3a113bdd"},
@@ -289,6 +287,7 @@ version = "26.1.0"
description = "Classes Without Boilerplate"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "attrs-26.1.0-py3-none-any.whl", hash = "sha256:c647aa4a12dfbad9333ca4e71fe62ddc36f4e63b2d260a37a8b83d2f043ac309"},
{file = "attrs-26.1.0.tar.gz", hash = "sha256:d03ceb89cb322a8fd706d4fb91940737b6642aa36998fe130a9bc96c985eff32"},
@@ -300,6 +299,7 @@ version = "2.2.1"
description = "Function decoration for backoff and retry"
optional = false
python-versions = ">=3.7,<4.0"
+groups = ["main"]
files = [
{file = "backoff-2.2.1-py3-none-any.whl", hash = "sha256:63579f9a0628e06278f7e47b7d7d5b6ce20dc65c5e96a6f3ca99a6adca0396e8"},
{file = "backoff-2.2.1.tar.gz", hash = "sha256:03f829f5bb1923180821643f8753b0502c3b682293992485b0eef2807afa5cba"},
@@ -311,6 +311,7 @@ version = "25.0.0"
description = "When they're not builtins, they're boltons."
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "boltons-25.0.0-py3-none-any.whl", hash = "sha256:dc9fb38bf28985715497d1b54d00b62ea866eca3938938ea9043e254a3a6ca62"},
{file = "boltons-25.0.0.tar.gz", hash = "sha256:e110fbdc30b7b9868cb604e3f71d4722dd8f4dcb4a5ddd06028ba8f1ab0b5ace"},
@@ -322,6 +323,7 @@ version = "2.6"
description = "Bash style brace expander."
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "bracex-2.6-py3-none-any.whl", hash = "sha256:0b0049264e7340b3ec782b5cb99beb325f36c3782a32e36e876452fd49a09952"},
{file = "bracex-2.6.tar.gz", hash = "sha256:98f1347cd77e22ee8d967a30ad4e310b233f7754dbf31ff3fceb76145ba47dc7"},
@@ -333,6 +335,7 @@ version = "2.0.1"
description = "A decorator for caching properties in classes."
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "cached_property-2.0.1-py3-none-any.whl", hash = "sha256:f617d70ab1100b7bcf6e42228f9ddcb78c676ffa167278d9f730d1c2fba69ccb"},
{file = "cached_property-2.0.1.tar.gz", hash = "sha256:484d617105e3ee0e4f1f58725e72a8ef9e93deee462222dbd51cd91230897641"},
@@ -344,6 +347,7 @@ version = "7.0.6"
description = "Extensible memoizing collections and decorators"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "cachetools-7.0.6-py3-none-any.whl", hash = "sha256:4e94956cfdd3086f12042cdd29318f5ced3893014f7d0d059bf3ead3f85b7f8b"},
{file = "cachetools-7.0.6.tar.gz", hash = "sha256:e5d524d36d65703a87243a26ff08ad84f73352adbeafb1cde81e207b456aaf24"},
@@ -355,6 +359,7 @@ version = "26.1.0"
description = "Composable complex class support for attrs and dataclasses."
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "cattrs-26.1.0-py3-none-any.whl", hash = "sha256:d1e0804c42639494d469d08d4f26d6b9de9b8ab26b446db7b5f8c2e97f7c3096"},
{file = "cattrs-26.1.0.tar.gz", hash = "sha256:fa239e0f0ec0715ba34852ce813986dfed1e12117e209b816ab87401271cdd40"},
@@ -362,18 +367,17 @@ files = [
[package.dependencies]
attrs = ">=25.4.0"
-exceptiongroup = {version = ">=1.1.1", markers = "python_version < \"3.11\""}
typing-extensions = ">=4.14.0"
[package.extras]
bson = ["pymongo (>=4.4.0)"]
cbor2 = ["cbor2 (>=5.4.6)"]
msgpack = ["msgpack (>=1.0.5)"]
-msgspec = ["msgspec (>=0.19.0)"]
-orjson = ["orjson (>=3.11.3)"]
+msgspec = ["msgspec (>=0.19.0) ; implementation_name == \"cpython\""]
+orjson = ["orjson (>=3.11.3) ; implementation_name == \"cpython\""]
pyyaml = ["pyyaml (>=6.0)"]
tomlkit = ["tomlkit (>=0.11.8)"]
-tomllib = ["tomli (>=1.1.0)", "tomli-w (>=1.1.0)"]
+tomllib = ["tomli (>=1.1.0) ; python_version < \"3.11\"", "tomli-w (>=1.1.0)"]
ujson = ["ujson (>=5.10.0)"]
[[package]]
@@ -382,6 +386,7 @@ version = "2026.4.22"
description = "Python package for providing Mozilla's CA Bundle."
optional = false
python-versions = ">=3.7"
+groups = ["main", "dev"]
files = [
{file = "certifi-2026.4.22-py3-none-any.whl", hash = "sha256:3cb2210c8f88ba2318d29b0388d1023c8492ff72ecdde4ebdaddbb13a31b1c4a"},
{file = "certifi-2026.4.22.tar.gz", hash = "sha256:8d455352a37b71bf76a79caa83a3d6c25afee4a385d632127b6afb3963f1c580"},
@@ -393,6 +398,8 @@ version = "2.0.0"
description = "Foreign Function Interface for Python calling C code."
optional = false
python-versions = ">=3.9"
+groups = ["main"]
+markers = "platform_python_implementation != \"PyPy\""
files = [
{file = "cffi-2.0.0-cp310-cp310-macosx_10_13_x86_64.whl", hash = "sha256:0cf2d91ecc3fcc0625c2c530fe004f82c110405f101548512cce44322fa8ac44"},
{file = "cffi-2.0.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:f73b96c41e3b2adedc34a7356e64c8eb96e03a3782b535e043a986276ce12a49"},
@@ -489,6 +496,7 @@ version = "3.4.7"
description = "The Real First Universal Charset Detector. Open, modern and actively maintained alternative to Chardet."
optional = false
python-versions = ">=3.7"
+groups = ["main", "dev"]
files = [
{file = "charset_normalizer-3.4.7-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cdd68a1fb318e290a2077696b7eb7a21a49163c455979c639bf5a5dcdc46617d"},
{file = "charset_normalizer-3.4.7-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:e17b8d5d6a8c47c85e68ca8379def1303fd360c3e22093a807cd34a71cd082b8"},
@@ -627,6 +635,7 @@ version = "8.3.3"
description = "Composable command line interface toolkit"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "click-8.3.3-py3-none-any.whl", hash = "sha256:a2bf429bb3033c89fa4936ffb35d5cb471e3719e1f3c8a7c3fff0b8314305613"},
{file = "click-8.3.3.tar.gz", hash = "sha256:398329ad4837b2ff7cbe1dd166a4c0f8900c3ca3a218de04466f38f6497f18a2"},
@@ -641,10 +650,12 @@ version = "0.4.6"
description = "Cross-platform colored terminal text."
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7"
+groups = ["main", "dev"]
files = [
{file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"},
{file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"},
]
+markers = {main = "platform_system == \"Windows\"", dev = "sys_platform == \"win32\""}
[[package]]
name = "cryptography"
@@ -652,6 +663,7 @@ version = "44.0.3"
description = "cryptography is a package which provides cryptographic recipes and primitives to Python developers."
optional = false
python-versions = "!=3.9.0,!=3.9.1,>=3.7"
+groups = ["main"]
files = [
{file = "cryptography-44.0.3-cp37-abi3-macosx_10_9_universal2.whl", hash = "sha256:962bc30480a08d133e631e8dfd4783ab71cc9e33d5d7c1e192f0b7c06397bb88"},
{file = "cryptography-44.0.3-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4ffc61e8f3bf5b60346d89cd3d37231019c17a081208dfbbd6e1605ba03fa137"},
@@ -696,10 +708,10 @@ files = [
cffi = {version = ">=1.12", markers = "platform_python_implementation != \"PyPy\""}
[package.extras]
-docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=3.0.0)"]
+docs = ["sphinx (>=5.3.0)", "sphinx-rtd-theme (>=3.0.0) ; python_version >= \"3.8\""]
docstest = ["pyenchant (>=3)", "readme-renderer (>=30.0)", "sphinxcontrib-spelling (>=7.3.1)"]
-nox = ["nox (>=2024.4.15)", "nox[uv] (>=2024.3.2)"]
-pep8test = ["check-sdist", "click (>=8.0.1)", "mypy (>=1.4)", "ruff (>=0.3.6)"]
+nox = ["nox (>=2024.4.15)", "nox[uv] (>=2024.3.2) ; python_version >= \"3.8\""]
+pep8test = ["check-sdist ; python_version >= \"3.8\"", "click (>=8.0.1)", "mypy (>=1.4)", "ruff (>=0.3.6)"]
sdist = ["build (>=1.0.0)"]
ssh = ["bcrypt (>=3.1.5)"]
test = ["certifi (>=2024)", "cryptography-vectors (==44.0.3)", "pretend (>=0.7)", "pytest (>=7.4.0)", "pytest-benchmark (>=4.0)", "pytest-cov (>=2.10.1)", "pytest-xdist (>=3.5.0)"]
@@ -711,6 +723,7 @@ version = "3.0.0"
description = "Convert Requests request objects to curl commands."
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "curlify-3.0.0-py3-none-any.whl", hash = "sha256:52060c0eb7a656b7bde6b668c32f337bed4d736ce230755767e3ada56a09c338"},
{file = "curlify-3.0.0.tar.gz", hash = "sha256:7b488ff3c924dba3433a1cc74044c0942da21f0a97fa26c3138319ba640ca412"},
@@ -725,6 +738,7 @@ version = "1.4.0"
description = "Date parsing library designed to parse dates from HTML pages"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "dateparser-1.4.0-py3-none-any.whl", hash = "sha256:7902b8e85d603494bf70a5a0b1decdddb2270b9c6e6b2bc8a57b93476c0df378"},
{file = "dateparser-1.4.0.tar.gz", hash = "sha256:97a21840d5ecdf7630c584f673338a5afac5dfe84f647baf4d7e8df98f9354a4"},
@@ -747,6 +761,7 @@ version = "2.2.0"
description = "Filesystem-like pathing and searching for dictionaries"
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "dpath-2.2.0-py3-none-any.whl", hash = "sha256:b330a375ded0a0d2ed404440f6c6a715deae5313af40bbb01c8a41d891900576"},
{file = "dpath-2.2.0.tar.gz", hash = "sha256:34f7e630dc55ea3f219e555726f5da4b4b25f2200319c8e6902c394258dd6a3e"},
@@ -758,6 +773,7 @@ version = "1.26.1"
description = "Dynamic version generation"
optional = false
python-versions = ">=3.5"
+groups = ["main"]
files = [
{file = "dunamai-1.26.1-py3-none-any.whl", hash = "sha256:2727d939c5b4257cb01ea404372803b477f5176e5a347c43beaf89cd5072e853"},
{file = "dunamai-1.26.1.tar.gz", hash = "sha256:3b46007bd65b00b4824ead0a1aee365fd22d0ec2b9c219497d4fd48f52860c8b"},
@@ -766,29 +782,13 @@ files = [
[package.dependencies]
packaging = ">=20.9"
-[[package]]
-name = "exceptiongroup"
-version = "1.3.1"
-description = "Backport of PEP 654 (exception groups)"
-optional = false
-python-versions = ">=3.7"
-files = [
- {file = "exceptiongroup-1.3.1-py3-none-any.whl", hash = "sha256:a7a39a3bd276781e98394987d3a5701d0c4edffb633bb7a5144577f82c773598"},
- {file = "exceptiongroup-1.3.1.tar.gz", hash = "sha256:8b412432c6055b0b7d14c310000ae93352ed6754f70fa8f7c34141f91c4e3219"},
-]
-
-[package.dependencies]
-typing-extensions = {version = ">=4.6.0", markers = "python_version < \"3.13\""}
-
-[package.extras]
-test = ["pytest (>=6)"]
-
[[package]]
name = "facebook-business"
version = "25.0.1"
description = "Facebook Business SDK"
optional = false
python-versions = "*"
+groups = ["main"]
files = [
{file = "facebook_business-25.0.1-py3-none-any.whl", hash = "sha256:a0ca91d268e0cc4460c48db92b26663a30e0f6ebbb269deb067010d99dff046c"},
{file = "facebook_business-25.0.1.tar.gz", hash = "sha256:9bfb0e7cce998085d3aab8259535b3838ee4404a489baef73525d719a0e8bf4d"},
@@ -807,6 +807,7 @@ version = "1.5.5"
description = "Let your Python tests travel through time"
optional = false
python-versions = ">=3.8"
+groups = ["dev"]
files = [
{file = "freezegun-1.5.5-py3-none-any.whl", hash = "sha256:cd557f4a75cf074e84bc374249b9dd491eaeacd61376b9eb3c423282211619d2"},
{file = "freezegun-1.5.5.tar.gz", hash = "sha256:ac7742a6cc6c25a2c35e9292dfd554b897b517d2dec26891a2e8debf205cb94a"},
@@ -821,6 +822,7 @@ version = "1.8.0"
description = "A list-like structure which implements collections.abc.MutableSequence"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "frozenlist-1.8.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b37f6d31b3dcea7deb5e9696e529a6aa4a898adc33db82da12e4c60a7c4d2011"},
{file = "frozenlist-1.8.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:ef2b7b394f208233e471abc541cc6991f907ffd47dc72584acee3147899d6565"},
@@ -960,6 +962,7 @@ version = "1.3.0"
description = "GenSON is a powerful, user-friendly JSON Schema generator."
optional = false
python-versions = "*"
+groups = ["main"]
files = [
{file = "genson-1.3.0-py3-none-any.whl", hash = "sha256:468feccd00274cc7e4c09e84b08704270ba8d95232aa280f65b986139cec67f7"},
{file = "genson-1.3.0.tar.gz", hash = "sha256:e02db9ac2e3fd29e65b5286f7135762e2cd8a986537c075b06fc5f1517308e37"},
@@ -971,6 +974,7 @@ version = "2.30.3"
description = "Google API client core library"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "google_api_core-2.30.3-py3-none-any.whl", hash = "sha256:a85761ba72c444dad5d611c2220633480b2b6be2521eca69cca2dbb3ffd6bfe8"},
{file = "google_api_core-2.30.3.tar.gz", hash = "sha256:e601a37f148585319b26db36e219df68c5d07b6382cff2d580e83404e44d641b"},
@@ -979,21 +983,18 @@ files = [
[package.dependencies]
google-auth = ">=2.14.1,<3.0.0"
googleapis-common-protos = ">=1.63.2,<2.0.0"
-grpcio = [
- {version = ">=1.33.2,<2.0.0", optional = true, markers = "python_version < \"3.11\" and extra == \"grpc\""},
- {version = ">=1.49.1,<2.0.0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""},
+grpcio = {version = ">=1.49.1,<2.0.0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""}
+grpcio-status = {version = ">=1.49.1,<2.0.0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""}
+proto-plus = [
+ {version = ">=1.22.3,<2.0.0"},
+ {version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""},
]
-grpcio-status = [
- {version = ">=1.33.2,<2.0.0", optional = true, markers = "python_version < \"3.11\" and extra == \"grpc\""},
- {version = ">=1.49.1,<2.0.0", optional = true, markers = "python_version >= \"3.11\" and extra == \"grpc\""},
-]
-proto-plus = ">=1.22.3,<2.0.0"
protobuf = ">=4.25.8,<8.0.0"
requests = ">=2.20.0,<3.0.0"
[package.extras]
async-rest = ["google-auth[aiohttp] (>=2.35.0,<3.0.0)"]
-grpc = ["grpcio (>=1.33.2,<2.0.0)", "grpcio (>=1.49.1,<2.0.0)", "grpcio (>=1.75.1,<2.0.0)", "grpcio-status (>=1.33.2,<2.0.0)", "grpcio-status (>=1.49.1,<2.0.0)", "grpcio-status (>=1.75.1,<2.0.0)"]
+grpc = ["grpcio (>=1.33.2,<2.0.0)", "grpcio (>=1.49.1,<2.0.0) ; python_version >= \"3.11\"", "grpcio (>=1.75.1,<2.0.0) ; python_version >= \"3.14\"", "grpcio-status (>=1.33.2,<2.0.0)", "grpcio-status (>=1.49.1,<2.0.0) ; python_version >= \"3.11\"", "grpcio-status (>=1.75.1,<2.0.0) ; python_version >= \"3.14\""]
[[package]]
name = "google-auth"
@@ -1001,6 +1002,7 @@ version = "2.49.2"
description = "Google Authentication Library"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "google_auth-2.49.2-py3-none-any.whl", hash = "sha256:c2720924dfc82dedb962c9f52cabb2ab16714fd0a6a707e40561d217574ed6d5"},
{file = "google_auth-2.49.2.tar.gz", hash = "sha256:c1ae38500e73065dcae57355adb6278cf8b5c8e391994ae9cbadbcb9631ab409"},
@@ -1028,6 +1030,7 @@ version = "2.27.0"
description = "Google Cloud Secret Manager API client library"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "google_cloud_secret_manager-2.27.0-py3-none-any.whl", hash = "sha256:e5540bece65a3ad720146f3b438973faf9315109b3ffa012a58711843047a3dc"},
{file = "google_cloud_secret_manager-2.27.0.tar.gz", hash = "sha256:6af864c252bd3c11db7bb02b80cb0b14a8c9a33fc7ec4d6f245f33d8ce1f7cd1"},
@@ -1035,10 +1038,13 @@ files = [
[package.dependencies]
google-api-core = {version = ">=2.11.0,<3.0.0", extras = ["grpc"]}
-google-auth = ">=2.14.1,<2.24.0 || >2.24.0,<2.25.0 || >2.25.0,<3.0.0"
+google-auth = ">=2.14.1,!=2.24.0,!=2.25.0,<3.0.0"
grpc-google-iam-v1 = ">=0.14.0,<1.0.0"
grpcio = ">=1.33.2,<2.0.0"
-proto-plus = ">=1.22.3,<2.0.0"
+proto-plus = [
+ {version = ">=1.22.3,<2.0.0", markers = "python_version < \"3.13\""},
+ {version = ">=1.25.0,<2.0.0", markers = "python_version >= \"3.13\""},
+]
protobuf = ">=4.25.8,<8.0.0"
[[package]]
@@ -1047,6 +1053,7 @@ version = "1.74.0"
description = "Common protobufs used in Google APIs"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "googleapis_common_protos-1.74.0-py3-none-any.whl", hash = "sha256:702216f78610bb510e3f12ac3cafd281b7ac45cc5d86e90ad87e4d301a3426b5"},
{file = "googleapis_common_protos-1.74.0.tar.gz", hash = "sha256:57971e4eeeba6aad1163c1f0fc88543f965bb49129b8bb55b2b7b26ecab084f1"},
@@ -1065,6 +1072,7 @@ version = "0.14.4"
description = "IAM API client library"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "grpc_google_iam_v1-0.14.4-py3-none-any.whl", hash = "sha256:412facc320fcbd94034b4df3d557662051d4d8adfa86e0ddb4dca70a3f739964"},
{file = "grpc_google_iam_v1-0.14.4.tar.gz", hash = "sha256:392b3796947ed6334e61171d9ab06bf7eb357f554e5fc7556ad7aab6d0e17038"},
@@ -1081,6 +1089,7 @@ version = "1.80.0"
description = "HTTP/2-based RPC framework"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "grpcio-1.80.0-cp310-cp310-linux_armv7l.whl", hash = "sha256:886457a7768e408cdce226ad1ca67d2958917d306523a0e21e1a2fdaa75c9c9c"},
{file = "grpcio-1.80.0-cp310-cp310-macosx_11_0_universal2.whl", hash = "sha256:7b641fc3f1dc647bfd80bd713addc68f6d145956f64677e56d9ebafc0bd72388"},
@@ -1157,6 +1166,7 @@ version = "1.62.3"
description = "Status proto mapping for gRPC"
optional = false
python-versions = ">=3.6"
+groups = ["main"]
files = [
{file = "grpcio-status-1.62.3.tar.gz", hash = "sha256:289bdd7b2459794a12cf95dc0cb727bd4a1742c37bd823f760236c937e53a485"},
{file = "grpcio_status-1.62.3-py3-none-any.whl", hash = "sha256:f9049b762ba8de6b1086789d8315846e094edac2c50beaf462338b301a8fd4b8"},
@@ -1173,6 +1183,7 @@ version = "3.13"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = ">=3.8"
+groups = ["main", "dev"]
files = [
{file = "idna-3.13-py3-none-any.whl", hash = "sha256:892ea0cde124a99ce773decba204c5552b69c3c67ffd5f232eb7696135bc8bb3"},
{file = "idna-3.13.tar.gz", hash = "sha256:585ea8fe5d69b9181ec1afba340451fba6ba764af97026f92a91d4eef164a242"},
@@ -1181,12 +1192,126 @@ files = [
[package.extras]
all = ["mypy (>=1.11.2)", "pytest (>=8.3.2)", "ruff (>=0.6.2)"]
+[[package]]
+name = "ijson"
+version = "3.6.0"
+description = "Iterative JSON parser with standard Python iterator interfaces"
+optional = false
+python-versions = ">=3.10"
+groups = ["main"]
+files = [
+ {file = "ijson-3.6.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:b207ffd091f4f0cac14d283529fd40e974510bf5152b00d2efcb2975e599581b"},
+ {file = "ijson-3.6.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:42241cac70f9a0d690dcab88f7ab83ab479ddeee0b56b4120a104119622f01fa"},
+ {file = "ijson-3.6.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:07a8430200f6afa9562cc51fad77dc77ecaf28a75c112504a3d74172ee9a0346"},
+ {file = "ijson-3.6.0-cp310-cp310-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:616156831be7f2eb37ba8e338b2182b3e54e09b0d21827c05c159c94df0b54fc"},
+ {file = "ijson-3.6.0-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:4a3372a9565265ea7808c044d6f04ea2db4ca29db00bf1121da44c9dde88ac52"},
+ {file = "ijson-3.6.0-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d2fa6ddc5bd997e7addca3cf8831825481eeb3359832d6657a60cda66409e980"},
+ {file = "ijson-3.6.0-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:417138b91db19b555abb07dfb14a744811190a5f4705edc776405a8dfcd5ef32"},
+ {file = "ijson-3.6.0-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:4c4f45476b8f366d1d4c630a8c7aaa28fb5765e9f5adcf64cb248c3a5f44aa2e"},
+ {file = "ijson-3.6.0-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:524ac54359985891d24ed66eeef4c20bc47f8654756370443bfabfaebe64e092"},
+ {file = "ijson-3.6.0-cp310-cp310-win32.whl", hash = "sha256:20af3cc567c609c4cd78ab3865477ea905d8073f675ff02bc10388f1bfc7d094"},
+ {file = "ijson-3.6.0-cp310-cp310-win_amd64.whl", hash = "sha256:fbf6d5bb1e765fd87fce5cbe2e9ff4adaaaaa80c8b01289b517430d1cbea2b2b"},
+ {file = "ijson-3.6.0-cp310-cp310-win_arm64.whl", hash = "sha256:618ca300eae78ce920bb2b5d4728e01cca289c01c50bbb6d842a8ede78d223ec"},
+ {file = "ijson-3.6.0-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:2057d59e3b92e03128cbbaaf67b03ea2179535a163a2f61193c1ad5f2dc02d52"},
+ {file = "ijson-3.6.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:52f93134b6dffa045bd1f457b30c995edeb45856551adaeeac69da04fa701603"},
+ {file = "ijson-3.6.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9aa0b7c301a01e2fb994d3cc420956b0d85f6a4237433948a5de108353fdb1e4"},
+ {file = "ijson-3.6.0-cp311-cp311-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:c4d80d961e3d8a6bb081595fdd55fd7c66a84f95377aecaca440a7f27a689516"},
+ {file = "ijson-3.6.0-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:a50ba1d5f8af50854243cbf523eff22a26f45f2b51a6c85177bbff48c99dfa2e"},
+ {file = "ijson-3.6.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:fa09fa38307b66c43efc98077f21e18e0af2fd192ff42130834cdcf4720424a6"},
+ {file = "ijson-3.6.0-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:09aa0c75005fb03644e21a694b836ef486e1a895149b268b9d8f6e6feb8a6377"},
+ {file = "ijson-3.6.0-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:97787614c30031fc8cdf6a5d52ab5052783eddc27ec0abd03d94fa2facfb6eb9"},
+ {file = "ijson-3.6.0-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:dfe79b9eda5a230e78d11eff998e042eb401f3151b6a93759107679b34b81d72"},
+ {file = "ijson-3.6.0-cp311-cp311-win32.whl", hash = "sha256:e9849d7dce894160f19b66db0b4e74f8725276effed2b8028e9b723389863f3b"},
+ {file = "ijson-3.6.0-cp311-cp311-win_amd64.whl", hash = "sha256:c9b54231c7ee3e7bbbf143b8d5f003bc4ffefb523e103d99517cdd03cc203d57"},
+ {file = "ijson-3.6.0-cp311-cp311-win_arm64.whl", hash = "sha256:71c23e991600aff8478447508e8bb01ef98751bd0e43120cd8df8ff6ba03bd33"},
+ {file = "ijson-3.6.0-cp312-cp312-macosx_10_13_universal2.whl", hash = "sha256:91c2b3877f02ddb0f557ca88254491d14053a6d91703ea2338542f7b576a6e82"},
+ {file = "ijson-3.6.0-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:914a87f45cc84f40863f9613f325c9b7824b4061ef75aaeb6897eaf885269ffe"},
+ {file = "ijson-3.6.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:55f8b704afdbda7fde2d317afd6af8638938c81d467ca46d0b8bcb6cf998ac7c"},
+ {file = "ijson-3.6.0-cp312-cp312-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:a8569bdbb524d9fe76518bc62438a3eefe0d36fb380bb4d98e738017a6624f9b"},
+ {file = "ijson-3.6.0-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1e592cd601f91424428e7cbce11f7ab0d5430253a81e60f8a69981fb1136c77c"},
+ {file = "ijson-3.6.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:c14d568d31a322e8ed7e9735f6e355608a23cc6ff4b5da843515089dae4cbf5f"},
+ {file = "ijson-3.6.0-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:8ee59d754e28247c5ef631ca013a70ca705f292a46e65b59b78f7a4b7f59871a"},
+ {file = "ijson-3.6.0-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:bb9f6c27fdda6d43993b25a49ca7903979c4c29bd6722b3dbf4e7061794e9cbc"},
+ {file = "ijson-3.6.0-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:3c88c4ddccb99a4c30aa0a6adff91bcaeb7467650c0e6a50585b5f51deeb1146"},
+ {file = "ijson-3.6.0-cp312-cp312-win32.whl", hash = "sha256:967318686d689286f32794e01fa11c2181e7fbf43940e016f3056f8d5643d055"},
+ {file = "ijson-3.6.0-cp312-cp312-win_amd64.whl", hash = "sha256:d5aceb2da334db519c5bb7be0d043f357493554bda2a480eea3e2fe78352ab0c"},
+ {file = "ijson-3.6.0-cp312-cp312-win_arm64.whl", hash = "sha256:370ea402f105c3cf89783ad6add670a24aa03949392db5f0614420566e4914b8"},
+ {file = "ijson-3.6.0-cp313-cp313-macosx_10_13_universal2.whl", hash = "sha256:4333247a212d997d8b58555b135c8d28f68cf43218fadc28bf28f3ffafaae676"},
+ {file = "ijson-3.6.0-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:5ab7107ca09caa5af5d94a859065a168b2b56d5822db34ef93bd7b31f088039a"},
+ {file = "ijson-3.6.0-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:fb87bee137e396e1d8c7e759bf072db5cc9b8c4e730e3b388d71cd710fa3fc11"},
+ {file = "ijson-3.6.0-cp313-cp313-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:4e9b0b97de6c1cebd501b3cc165e080d6c6309a43b5d6c3ce3e76b6c938b2ad7"},
+ {file = "ijson-3.6.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:82683a1946b6af5084711fc1032ef64423215eb965ab4df539b683664eebe049"},
+ {file = "ijson-3.6.0-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:3cdf857bf286c5e4854eacb6434a9c1006fbc1c44c58ff79293ccaca95ec7b82"},
+ {file = "ijson-3.6.0-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:0dd543c0d5e5c8ec9e1570cbe805c57271b1f272e57c86794b226e2a03466cec"},
+ {file = "ijson-3.6.0-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:fa6a0f303792fd89bbeb2e5ff4e53ee2c5c9d59bf2bed49dcd98adf413178f4e"},
+ {file = "ijson-3.6.0-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:2e19a3c7b0dc3dcaf2bda1c8033d021aec8b7e862b33e903d79b944eea96d389"},
+ {file = "ijson-3.6.0-cp313-cp313-win32.whl", hash = "sha256:65e65a6e28d95edafa2c99dae7f7c1a5c3403bf5bb62bc6eb919fefff5298dad"},
+ {file = "ijson-3.6.0-cp313-cp313-win_amd64.whl", hash = "sha256:cf855a688dd80570e6daaa67afc84a950acf9c6ba9c3526096957614d21db1bd"},
+ {file = "ijson-3.6.0-cp313-cp313-win_arm64.whl", hash = "sha256:6a7a242aca8e03261c59290be66f428cef6b0a1b4d4a7596aa33fe113faf15f3"},
+ {file = "ijson-3.6.0-cp314-cp314-macosx_10_15_universal2.whl", hash = "sha256:be07a2773667f189a329cce0520df8d146825caefa7af9b4366883ceb4f24b45"},
+ {file = "ijson-3.6.0-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:6213dce68c6bac784c6929f80941358756a7cd5260209cdb0bd08be1c4829d04"},
+ {file = "ijson-3.6.0-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:67a754d7166821402f49c553a6c9e67799aa3f76d8c6ff554ed10444b166fd4d"},
+ {file = "ijson-3.6.0-cp314-cp314-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:6ce4e105fbce77b2038e281c3715c2e984affe79594fcb750c61b6ee7cc12f14"},
+ {file = "ijson-3.6.0-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9f029f72a33cbf6781ffa0198ff3d96637e7202b46040b66ebca0623e5e0a9a3"},
+ {file = "ijson-3.6.0-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:09ab289fc2faf66575c4a1c626cddd413843f5508829fb4c2370fe584624d396"},
+ {file = "ijson-3.6.0-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:f8548b45c9313e8ee0138073d86aca14adbf6e48a3f1f315ab6e7ae316df9c9e"},
+ {file = "ijson-3.6.0-cp314-cp314-musllinux_1_2_i686.whl", hash = "sha256:3be142820cd2c6c5f4830a017cde667c7344bcedaebe37d92d7e59b5713752fc"},
+ {file = "ijson-3.6.0-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:20b97ab48a802c1e6839438b788ab7e6cbb7a4ee0575a17eb4118d2d91e4bd75"},
+ {file = "ijson-3.6.0-cp314-cp314-win32.whl", hash = "sha256:4462653b135f5a3de2583b9acae14517ef660ab2df0defcb5946d510fd4d5842"},
+ {file = "ijson-3.6.0-cp314-cp314-win_amd64.whl", hash = "sha256:f151fd21639984e4fc76b7a568426fc6ab1024fe73d9955fc498ea8104df4a6e"},
+ {file = "ijson-3.6.0-cp314-cp314-win_arm64.whl", hash = "sha256:9ef59a9c531cb3e478631c6367c32966330fa656c711be5f0001999a18c9d98f"},
+ {file = "ijson-3.6.0-cp314-cp314t-macosx_10_15_universal2.whl", hash = "sha256:ac5ee1a8d95a83cfb957378c8b6b3c69d099b399532454d1edd226547f0f50e5"},
+ {file = "ijson-3.6.0-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:7503e53a3e5c0b52a61259c453f5c12f15a3b675b1158dbec6cbe30284d5d186"},
+ {file = "ijson-3.6.0-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:e6cd6f4086929cb4ee888233fa1b40e194b5dc9e971a13302badbff546c9932e"},
+ {file = "ijson-3.6.0-cp314-cp314t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:57737b2cabddb5a2405f4e875a550a253c94f42f5e2a90b36d23ae52873d3b48"},
+ {file = "ijson-3.6.0-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:bc26be6ed77378bf93588e039817035db415af56b1b37cf7283b6ebc291b0943"},
+ {file = "ijson-3.6.0-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:407a8f95d9897f4e4228564411e4493de4d65e8e1e674f87cc4bfb5cdcd5644b"},
+ {file = "ijson-3.6.0-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:889a4075b1c74513d0a890f47a4e8d33fb21fc7f783743a1fefeafc27da5f55f"},
+ {file = "ijson-3.6.0-cp314-cp314t-musllinux_1_2_i686.whl", hash = "sha256:3d30bd21694dd12375a7c192ace682a46907b9fe181a46cd0850c7f620038ea9"},
+ {file = "ijson-3.6.0-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:6b3436a09a3dc494791862a623619a2304b812eda739a710b8a474bb9f3e5065"},
+ {file = "ijson-3.6.0-cp314-cp314t-win32.whl", hash = "sha256:78915030a2ff3e0ae0a95dc7d5b1d2e3e1f2a283266ae2d87cfd4d16be945ea6"},
+ {file = "ijson-3.6.0-cp314-cp314t-win_amd64.whl", hash = "sha256:8b1fbb26ddc6002e131e935370de1b171a66cc1599e285eefd37cd1f681004a7"},
+ {file = "ijson-3.6.0-cp314-cp314t-win_arm64.whl", hash = "sha256:3b9d136436134c98294afd3efb49c7360c81da07040ac50186971f37b53f77ee"},
+ {file = "ijson-3.6.0-cp315-cp315-macosx_10_15_universal2.whl", hash = "sha256:e58bc4b0470497e5d00f0faa055d0b8aef275ed210266d5f86ed17a23d064408"},
+ {file = "ijson-3.6.0-cp315-cp315-macosx_10_15_x86_64.whl", hash = "sha256:2e6b9c56a8a727153935c83d91450d1eae8f2a9ad4091360eb6ec03d47aa08e6"},
+ {file = "ijson-3.6.0-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:d847615380321e4dfb3d269deb562876f170ab9f46c80cbf880a2496fb09a0e3"},
+ {file = "ijson-3.6.0-cp315-cp315-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:e60c40f78fa00325df96d57f68786f1fed3e6091b9d41cf9811d22914dff8f94"},
+ {file = "ijson-3.6.0-cp315-cp315-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7b48f4ce1fbb89045e7b92defe75c848275f84734cef8ab01cfa3ee443d8a4bc"},
+ {file = "ijson-3.6.0-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5454696282add7cde430fc6dc90d0d65db2f1585303b8ec701e1c36aee14fc4c"},
+ {file = "ijson-3.6.0-cp315-cp315-musllinux_1_2_aarch64.whl", hash = "sha256:4b5addfd509ca4192ec7107a3f07d0295221e62b974d8abfa8cc9b67c10dc9e2"},
+ {file = "ijson-3.6.0-cp315-cp315-musllinux_1_2_i686.whl", hash = "sha256:160c94c9cac5837f49e5b9cbb725604e75694083260c7180ef381f705850992a"},
+ {file = "ijson-3.6.0-cp315-cp315-musllinux_1_2_x86_64.whl", hash = "sha256:7c1deb116218a900fe6f231544c31e8e2dd625819ff7ce5ce908aa19622fa1c9"},
+ {file = "ijson-3.6.0-cp315-cp315-win32.whl", hash = "sha256:20d227e46ff03ad2f40cb5bfa56adcc47b6713f7b81c67b9767f761ceded90bb"},
+ {file = "ijson-3.6.0-cp315-cp315-win_amd64.whl", hash = "sha256:e18f1486106c072c037a8699c9ff1450574c395f45687cdf5b4142d9c2d2df61"},
+ {file = "ijson-3.6.0-cp315-cp315-win_arm64.whl", hash = "sha256:4bc6c5351352760fd0c29cc437e48598b92f66133f2be5ef712f75180e1759a7"},
+ {file = "ijson-3.6.0-cp315-cp315t-macosx_10_15_universal2.whl", hash = "sha256:96863aca6697edc2c5465e1dd2d7ea7b67b7743b9657adb1e65c04aab9c6c2ab"},
+ {file = "ijson-3.6.0-cp315-cp315t-macosx_10_15_x86_64.whl", hash = "sha256:5a7e4220d788bfa155fc2885edf04d8beada42eeaa260a02fe749d056dc6ffb9"},
+ {file = "ijson-3.6.0-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:ee99f497c4fd997bc6be85dfc72635ad69f08e8a727937193dd449c6b7f9348c"},
+ {file = "ijson-3.6.0-cp315-cp315t-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:21a7cd561d97f20a7011760d7b0687cafbd86b1f67738badb7809ce7e2385261"},
+ {file = "ijson-3.6.0-cp315-cp315t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:7dfd28144223c9ee6e0544b903efd334214cb2048c6e22f9cb9c11fdf1ae86d9"},
+ {file = "ijson-3.6.0-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:539b2d8b9427b322ccc15db0e7bda8cd7597be62bd07b969df3e482e67c11fb7"},
+ {file = "ijson-3.6.0-cp315-cp315t-musllinux_1_2_aarch64.whl", hash = "sha256:503c938e6ae6686e0c702b3ae33e37433450ca41c0d022746e7bef3173ea9778"},
+ {file = "ijson-3.6.0-cp315-cp315t-musllinux_1_2_i686.whl", hash = "sha256:2b0f27fc60291fb1aa73de1a4588476efb49f8a4977c20c679aa15480e3f63a8"},
+ {file = "ijson-3.6.0-cp315-cp315t-musllinux_1_2_x86_64.whl", hash = "sha256:130bbccf2569ca8fc69dd1496dc8f55231408cad56ccfdd9d4ab17593a65cc95"},
+ {file = "ijson-3.6.0-cp315-cp315t-win32.whl", hash = "sha256:600912be7871678688c7890c254d44421079781991badf84792073b43d05890b"},
+ {file = "ijson-3.6.0-cp315-cp315t-win_amd64.whl", hash = "sha256:9846fd8da153a478f797ac417b07ce47c0f73acd7798038ba16a45d417cb50c9"},
+ {file = "ijson-3.6.0-cp315-cp315t-win_arm64.whl", hash = "sha256:f994df777d7e9c4ac72a54ed382c9abef4804d705d8904acc19ed141a3604b3c"},
+ {file = "ijson-3.6.0-pp311-pypy311_pp73-macosx_10_15_x86_64.whl", hash = "sha256:25224e9090bf572da34400b4ff1c04740d360f4fb0ad3a940e0cfe7938f9ac82"},
+ {file = "ijson-3.6.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:7e8fd6dbc32233e27bb4705d2c7a75c23b86582d30cf1e9e04c241914883f8b8"},
+ {file = "ijson-3.6.0-pp311-pypy311_pp73-manylinux1_i686.manylinux_2_28_i686.manylinux_2_5_i686.whl", hash = "sha256:fba8a6d5d188fe18a22c7065c1486d13e9de2c109e0282271d81e76e479db86e"},
+ {file = "ijson-3.6.0-pp311-pypy311_pp73-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:90e1bfed93a43253106e167b0bce3b33e98b4c5cb292b9cbdd9a856b1f098417"},
+ {file = "ijson-3.6.0-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:126e7d6b8bd51563f631562764f347db9bfb4dcc9ff920be28ba7d65805e9594"},
+ {file = "ijson-3.6.0-pp311-pypy311_pp73-win_amd64.whl", hash = "sha256:e31899e714a25260c261d67ffd5159b8eb691508b91967f66dff861dd0ff3aec"},
+ {file = "ijson-3.6.0.tar.gz", hash = "sha256:ec8f9265524e724905ecf00bdd061c374baaa8d5045ef50425695fb06efb45f5"},
+]
+
[[package]]
name = "iniconfig"
version = "2.3.0"
description = "brain-dead simple config-ini parsing"
optional = false
python-versions = ">=3.10"
+groups = ["dev"]
files = [
{file = "iniconfig-2.3.0-py3-none-any.whl", hash = "sha256:f631c04d2c48c52b84d0d0549c99ff3859c98df65b3101406327ecc7d53fbf12"},
{file = "iniconfig-2.3.0.tar.gz", hash = "sha256:c76315c77db068650d49c5b56314774a7804df16fee4402c1f19d6d15d8c4730"},
@@ -1198,6 +1323,7 @@ version = "0.6.1"
description = "An ISO 8601 date/time/duration parser and formatter"
optional = false
python-versions = "*"
+groups = ["main"]
files = [
{file = "isodate-0.6.1-py2.py3-none-any.whl", hash = "sha256:0751eece944162659049d35f4f549ed815792b38793f07cf73381c1c87cbed96"},
{file = "isodate-0.6.1.tar.gz", hash = "sha256:48c5881de7e8b0a0d648cb024c8062dc84e7b840ed81e864c7614fd3c127bde9"},
@@ -1212,6 +1338,7 @@ version = "3.1.6"
description = "A very fast and expressive template engine."
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "jinja2-3.1.6-py3-none-any.whl", hash = "sha256:85ece4451f492d0c13c5dd7c13a64681a86afae63a5f347908daf103ce6d2f67"},
{file = "jinja2-3.1.6.tar.gz", hash = "sha256:0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d"},
@@ -1229,6 +1356,7 @@ version = "1.5.3"
description = "Lightweight pipelining with Python functions"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "joblib-1.5.3-py3-none-any.whl", hash = "sha256:5fc3c5039fc5ca8c0276333a188bbd59d6b7ab37fe6632daa76bc7f9ec18e713"},
{file = "joblib-1.5.3.tar.gz", hash = "sha256:8561a3269e6801106863fd0d6d84bb737be9e7631e33aaed3fb9ce5953688da3"},
@@ -1240,6 +1368,7 @@ version = "1.1.0"
description = "jsonref is a library for automatic dereferencing of JSON Reference objects for Python."
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "jsonref-1.1.0-py3-none-any.whl", hash = "sha256:590dc7773df6c21cbf948b5dac07a72a251db28b0238ceecce0a2abfa8ec30a9"},
{file = "jsonref-1.1.0.tar.gz", hash = "sha256:32fe8e1d85af0fdefbebce950af85590b22b60f9e95443176adbde4e1ecea552"},
@@ -1251,6 +1380,7 @@ version = "4.26.0"
description = "An implementation of JSON Schema validation for Python"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "jsonschema-4.26.0-py3-none-any.whl", hash = "sha256:d489f15263b8d200f8387e64b4c3a75f06629559fb73deb8fdfb525f2dab50ce"},
{file = "jsonschema-4.26.0.tar.gz", hash = "sha256:0c26707e2efad8aa1bfc5b7ce170f3fccc2e4918ff85989ba9ffa9facb2be326"},
@@ -1258,7 +1388,7 @@ files = [
[package.dependencies]
attrs = ">=22.2.0"
-jsonschema-specifications = ">=2023.03.6"
+jsonschema-specifications = ">=2023.3.6"
referencing = ">=0.28.4"
rpds-py = ">=0.25.0"
@@ -1272,6 +1402,7 @@ version = "2025.9.1"
description = "The JSON Schema meta-schemas and vocabularies, exposed as a Registry"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "jsonschema_specifications-2025.9.1-py3-none-any.whl", hash = "sha256:98802fee3a11ee76ecaca44429fda8a41bff98b00a0f2838151b113f210cc6fe"},
{file = "jsonschema_specifications-2025.9.1.tar.gz", hash = "sha256:b540987f239e745613c7a9176f3edb72b832a4ac465cf02712288397832b5e8d"},
@@ -1286,6 +1417,7 @@ version = "4.0.0"
description = "Python port of markdown-it. Markdown parsing, done right!"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "markdown_it_py-4.0.0-py3-none-any.whl", hash = "sha256:87327c59b172c5011896038353a81343b6754500a08cd7a4973bb48c6d578147"},
{file = "markdown_it_py-4.0.0.tar.gz", hash = "sha256:cb0a2b4aa34f932c007117b194e945bd74e0ec24133ceb5bac59009cda1cb9f3"},
@@ -1309,6 +1441,7 @@ version = "3.0.3"
description = "Safely add untrusted strings to HTML/XML markup."
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "markupsafe-3.0.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:2f981d352f04553a7171b8e44369f2af4055f888dfb147d55e42d29e29e74559"},
{file = "markupsafe-3.0.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:e1c1493fb6e50ab01d20a22826e57520f1284df32f2d8601fdd90b6304601419"},
@@ -1407,6 +1540,7 @@ version = "0.1.2"
description = "Markdown URL utilities"
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"},
{file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"},
@@ -1418,6 +1552,7 @@ version = "6.7.1"
description = "multidict implementation"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "multidict-6.7.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:c93c3db7ea657dd4637d57e74ab73de31bccefe144d3d4ce370052035bc85fb5"},
{file = "multidict-6.7.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:974e72a2474600827abaeda71af0c53d9ebbc3c2eb7da37b37d7829ae31232d8"},
@@ -1567,18 +1702,16 @@ files = [
{file = "multidict-6.7.1.tar.gz", hash = "sha256:ec6652a1bee61c53a3e5776b6049172c53b6aaba34f18c9ad04f82712bac623d"},
]
-[package.dependencies]
-typing-extensions = {version = ">=4.1.0", markers = "python_version < \"3.11\""}
-
[[package]]
name = "nltk"
-version = "3.9.1"
+version = "3.9.4"
description = "Natural Language Toolkit"
optional = false
-python-versions = ">=3.8"
+python-versions = ">=3.10"
+groups = ["main"]
files = [
- {file = "nltk-3.9.1-py3-none-any.whl", hash = "sha256:4fa26829c5b00715afe3061398a8989dc643b92ce7dd93fb4585a70930d168a1"},
- {file = "nltk-3.9.1.tar.gz", hash = "sha256:87d127bd3de4bd89a4f81265e5fa59cb1b199b27440175370f7417d2bc7ae868"},
+ {file = "nltk-3.9.4-py3-none-any.whl", hash = "sha256:f2fa301c3a12718ce4a0e9305c5675299da5ad9e26068218b69d692fda84828f"},
+ {file = "nltk-3.9.4.tar.gz", hash = "sha256:ed03bc098a40481310320808b2db712d95d13ca65b27372f8a403949c8b523d0"},
]
[package.dependencies]
@@ -1595,76 +1728,13 @@ plot = ["matplotlib"]
tgrep = ["pyparsing"]
twitter = ["twython"]
-[[package]]
-name = "numpy"
-version = "2.2.6"
-description = "Fundamental package for array computing in Python"
-optional = false
-python-versions = ">=3.10"
-files = [
- {file = "numpy-2.2.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:b412caa66f72040e6d268491a59f2c43bf03eb6c96dd8f0307829feb7fa2b6fb"},
- {file = "numpy-2.2.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:8e41fd67c52b86603a91c1a505ebaef50b3314de0213461c7a6e99c9a3beff90"},
- {file = "numpy-2.2.6-cp310-cp310-macosx_14_0_arm64.whl", hash = "sha256:37e990a01ae6ec7fe7fa1c26c55ecb672dd98b19c3d0e1d1f326fa13cb38d163"},
- {file = "numpy-2.2.6-cp310-cp310-macosx_14_0_x86_64.whl", hash = "sha256:5a6429d4be8ca66d889b7cf70f536a397dc45ba6faeb5f8c5427935d9592e9cf"},
- {file = "numpy-2.2.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:efd28d4e9cd7d7a8d39074a4d44c63eda73401580c5c76acda2ce969e0a38e83"},
- {file = "numpy-2.2.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fc7b73d02efb0e18c000e9ad8b83480dfcd5dfd11065997ed4c6747470ae8915"},
- {file = "numpy-2.2.6-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:74d4531beb257d2c3f4b261bfb0fc09e0f9ebb8842d82a7b4209415896adc680"},
- {file = "numpy-2.2.6-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:8fc377d995680230e83241d8a96def29f204b5782f371c532579b4f20607a289"},
- {file = "numpy-2.2.6-cp310-cp310-win32.whl", hash = "sha256:b093dd74e50a8cba3e873868d9e93a85b78e0daf2e98c6797566ad8044e8363d"},
- {file = "numpy-2.2.6-cp310-cp310-win_amd64.whl", hash = "sha256:f0fd6321b839904e15c46e0d257fdd101dd7f530fe03fd6359c1ea63738703f3"},
- {file = "numpy-2.2.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f9f1adb22318e121c5c69a09142811a201ef17ab257a1e66ca3025065b7f53ae"},
- {file = "numpy-2.2.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:c820a93b0255bc360f53eca31a0e676fd1101f673dda8da93454a12e23fc5f7a"},
- {file = "numpy-2.2.6-cp311-cp311-macosx_14_0_arm64.whl", hash = "sha256:3d70692235e759f260c3d837193090014aebdf026dfd167834bcba43e30c2a42"},
- {file = "numpy-2.2.6-cp311-cp311-macosx_14_0_x86_64.whl", hash = "sha256:481b49095335f8eed42e39e8041327c05b0f6f4780488f61286ed3c01368d491"},
- {file = "numpy-2.2.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b64d8d4d17135e00c8e346e0a738deb17e754230d7e0810ac5012750bbd85a5a"},
- {file = "numpy-2.2.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba10f8411898fc418a521833e014a77d3ca01c15b0c6cdcce6a0d2897e6dbbdf"},
- {file = "numpy-2.2.6-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:bd48227a919f1bafbdda0583705e547892342c26fb127219d60a5c36882609d1"},
- {file = "numpy-2.2.6-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:9551a499bf125c1d4f9e250377c1ee2eddd02e01eac6644c080162c0c51778ab"},
- {file = "numpy-2.2.6-cp311-cp311-win32.whl", hash = "sha256:0678000bb9ac1475cd454c6b8c799206af8107e310843532b04d49649c717a47"},
- {file = "numpy-2.2.6-cp311-cp311-win_amd64.whl", hash = "sha256:e8213002e427c69c45a52bbd94163084025f533a55a59d6f9c5b820774ef3303"},
- {file = "numpy-2.2.6-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:41c5a21f4a04fa86436124d388f6ed60a9343a6f767fced1a8a71c3fbca038ff"},
- {file = "numpy-2.2.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:de749064336d37e340f640b05f24e9e3dd678c57318c7289d222a8a2f543e90c"},
- {file = "numpy-2.2.6-cp312-cp312-macosx_14_0_arm64.whl", hash = "sha256:894b3a42502226a1cac872f840030665f33326fc3dac8e57c607905773cdcde3"},
- {file = "numpy-2.2.6-cp312-cp312-macosx_14_0_x86_64.whl", hash = "sha256:71594f7c51a18e728451bb50cc60a3ce4e6538822731b2933209a1f3614e9282"},
- {file = "numpy-2.2.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f2618db89be1b4e05f7a1a847a9c1c0abd63e63a1607d892dd54668dd92faf87"},
- {file = "numpy-2.2.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fd83c01228a688733f1ded5201c678f0c53ecc1006ffbc404db9f7a899ac6249"},
- {file = "numpy-2.2.6-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:37c0ca431f82cd5fa716eca9506aefcabc247fb27ba69c5062a6d3ade8cf8f49"},
- {file = "numpy-2.2.6-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:fe27749d33bb772c80dcd84ae7e8df2adc920ae8297400dabec45f0dedb3f6de"},
- {file = "numpy-2.2.6-cp312-cp312-win32.whl", hash = "sha256:4eeaae00d789f66c7a25ac5f34b71a7035bb474e679f410e5e1a94deb24cf2d4"},
- {file = "numpy-2.2.6-cp312-cp312-win_amd64.whl", hash = "sha256:c1f9540be57940698ed329904db803cf7a402f3fc200bfe599334c9bd84a40b2"},
- {file = "numpy-2.2.6-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:0811bb762109d9708cca4d0b13c4f67146e3c3b7cf8d34018c722adb2d957c84"},
- {file = "numpy-2.2.6-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:287cc3162b6f01463ccd86be154f284d0893d2b3ed7292439ea97eafa8170e0b"},
- {file = "numpy-2.2.6-cp313-cp313-macosx_14_0_arm64.whl", hash = "sha256:f1372f041402e37e5e633e586f62aa53de2eac8d98cbfb822806ce4bbefcb74d"},
- {file = "numpy-2.2.6-cp313-cp313-macosx_14_0_x86_64.whl", hash = "sha256:55a4d33fa519660d69614a9fad433be87e5252f4b03850642f88993f7b2ca566"},
- {file = "numpy-2.2.6-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f92729c95468a2f4f15e9bb94c432a9229d0d50de67304399627a943201baa2f"},
- {file = "numpy-2.2.6-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1bc23a79bfabc5d056d106f9befb8d50c31ced2fbc70eedb8155aec74a45798f"},
- {file = "numpy-2.2.6-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e3143e4451880bed956e706a3220b4e5cf6172ef05fcc397f6f36a550b1dd868"},
- {file = "numpy-2.2.6-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:b4f13750ce79751586ae2eb824ba7e1e8dba64784086c98cdbbcc6a42112ce0d"},
- {file = "numpy-2.2.6-cp313-cp313-win32.whl", hash = "sha256:5beb72339d9d4fa36522fc63802f469b13cdbe4fdab4a288f0c441b74272ebfd"},
- {file = "numpy-2.2.6-cp313-cp313-win_amd64.whl", hash = "sha256:b0544343a702fa80c95ad5d3d608ea3599dd54d4632df855e4c8d24eb6ecfa1c"},
- {file = "numpy-2.2.6-cp313-cp313t-macosx_10_13_x86_64.whl", hash = "sha256:0bca768cd85ae743b2affdc762d617eddf3bcf8724435498a1e80132d04879e6"},
- {file = "numpy-2.2.6-cp313-cp313t-macosx_11_0_arm64.whl", hash = "sha256:fc0c5673685c508a142ca65209b4e79ed6740a4ed6b2267dbba90f34b0b3cfda"},
- {file = "numpy-2.2.6-cp313-cp313t-macosx_14_0_arm64.whl", hash = "sha256:5bd4fc3ac8926b3819797a7c0e2631eb889b4118a9898c84f585a54d475b7e40"},
- {file = "numpy-2.2.6-cp313-cp313t-macosx_14_0_x86_64.whl", hash = "sha256:fee4236c876c4e8369388054d02d0e9bb84821feb1a64dd59e137e6511a551f8"},
- {file = "numpy-2.2.6-cp313-cp313t-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e1dda9c7e08dc141e0247a5b8f49cf05984955246a327d4c48bda16821947b2f"},
- {file = "numpy-2.2.6-cp313-cp313t-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f447e6acb680fd307f40d3da4852208af94afdfab89cf850986c3ca00562f4fa"},
- {file = "numpy-2.2.6-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:389d771b1623ec92636b0786bc4ae56abafad4a4c513d36a55dce14bd9ce8571"},
- {file = "numpy-2.2.6-cp313-cp313t-musllinux_1_2_x86_64.whl", hash = "sha256:8e9ace4a37db23421249ed236fdcdd457d671e25146786dfc96835cd951aa7c1"},
- {file = "numpy-2.2.6-cp313-cp313t-win32.whl", hash = "sha256:038613e9fb8c72b0a41f025a7e4c3f0b7a1b5d768ece4796b674c8f3fe13efff"},
- {file = "numpy-2.2.6-cp313-cp313t-win_amd64.whl", hash = "sha256:6031dd6dfecc0cf9f668681a37648373bddd6421fff6c66ec1624eed0180ee06"},
- {file = "numpy-2.2.6-pp310-pypy310_pp73-macosx_10_15_x86_64.whl", hash = "sha256:0b605b275d7bd0c640cad4e5d30fa701a8d59302e127e5f79138ad62762c3e3d"},
- {file = "numpy-2.2.6-pp310-pypy310_pp73-macosx_14_0_x86_64.whl", hash = "sha256:7befc596a7dc9da8a337f79802ee8adb30a552a94f792b9c9d18c840055907db"},
- {file = "numpy-2.2.6-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ce47521a4754c8f4593837384bd3424880629f718d87c5d44f8ed763edd63543"},
- {file = "numpy-2.2.6-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:d042d24c90c41b54fd506da306759e06e568864df8ec17ccc17e9e884634fd00"},
- {file = "numpy-2.2.6.tar.gz", hash = "sha256:e29554e2bef54a90aa5cc07da6ce955accb83f21ab5de01a62c8478897b264fd"},
-]
-
[[package]]
name = "numpy"
version = "2.4.4"
description = "Fundamental package for array computing in Python"
optional = false
python-versions = ">=3.11"
+groups = ["main"]
files = [
{file = "numpy-2.4.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f983334aea213c99992053ede6168500e5f086ce74fbc4acc3f2b00f5762e9db"},
{file = "numpy-2.4.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:72944b19f2324114e9dc86a159787333b77874143efcf89a5167ef83cfee8af0"},
@@ -1746,6 +1816,7 @@ version = "3.11.8"
description = "Fast, correct Python JSON library supporting dataclasses, datetimes, and numpy"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "orjson-3.11.8-cp310-cp310-macosx_10_15_x86_64.macosx_11_0_arm64.macosx_10_15_universal2.whl", hash = "sha256:e6693ff90018600c72fd18d3d22fa438be26076cd3c823da5f63f7bab28c11cb"},
{file = "orjson-3.11.8-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:93de06bc920854552493c81f1f729fab7213b7db4b8195355db5fda02c7d1363"},
@@ -1829,6 +1900,7 @@ version = "26.1"
description = "Core utilities for Python packages"
optional = false
python-versions = ">=3.8"
+groups = ["main", "dev"]
files = [
{file = "packaging-26.1-py3-none-any.whl", hash = "sha256:5d9c0669c6285e491e0ced2eee587eaf67b670d94a19e94e3984a481aba6802f"},
{file = "packaging-26.1.tar.gz", hash = "sha256:f042152b681c4bfac5cae2742a55e103d27ab2ec0f3d88037136b6bfe7c9c5de"},
@@ -1840,6 +1912,7 @@ version = "2.2.3"
description = "Powerful data structures for data analysis, time series, and statistics"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "pandas-2.2.3-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1948ddde24197a0f7add2bdc4ca83bf2b1ef84a1bc8ccffd95eda17fd836ecb5"},
{file = "pandas-2.2.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:381175499d3802cde0eabbaf6324cce0c4f5d52ca6f8c377c29ad442f50f6348"},
@@ -1887,8 +1960,8 @@ files = [
[package.dependencies]
numpy = [
- {version = ">=1.22.4", markers = "python_version < \"3.11\""},
{version = ">=1.23.2", markers = "python_version == \"3.11\""},
+ {version = ">=1.26.0", markers = "python_version >= \"3.12\""},
]
python-dateutil = ">=2.8.2"
pytz = ">=2020.1"
@@ -1925,6 +1998,7 @@ version = "4.9.6"
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a `user data dir`."
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "platformdirs-4.9.6-py3-none-any.whl", hash = "sha256:e61adb1d5e5cb3441b4b7710bea7e4c12250ca49439228cc1021c00dcfac0917"},
{file = "platformdirs-4.9.6.tar.gz", hash = "sha256:3bfa75b0ad0db84096ae777218481852c0ebc6c727b3168c1b9e0118e458cf0a"},
@@ -1936,6 +2010,7 @@ version = "1.6.0"
description = "plugin and hook calling mechanisms for python"
optional = false
python-versions = ">=3.9"
+groups = ["dev"]
files = [
{file = "pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746"},
{file = "pluggy-1.6.0.tar.gz", hash = "sha256:7dcc130b76258d33b90f61b658791dede3486c3e6bfb003ee5c9bfb396dd22f3"},
@@ -1951,6 +2026,7 @@ version = "0.4.1"
description = "Accelerated property cache"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "propcache-0.4.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:7c2d1fa3201efaf55d730400d945b5b3ab6e672e100ba0f9a409d950ab25d7db"},
{file = "propcache-0.4.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:1eb2994229cc8ce7fe9b3db88f5465f5fd8651672840b2e426b88cdb1a30aac8"},
@@ -2082,6 +2158,7 @@ version = "1.27.2"
description = "Beautiful, Pythonic protocol buffers"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "proto_plus-1.27.2-py3-none-any.whl", hash = "sha256:6432f75893d3b9e70b9c412f1d2f03f65b11fb164b793d14ae2ca01821d22718"},
{file = "proto_plus-1.27.2.tar.gz", hash = "sha256:b2adde53adadf75737c44d3dcb0104fde65250dfc83ad59168b4aa3e574b6a24"},
@@ -2099,6 +2176,7 @@ version = "7.34.1"
description = ""
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "protobuf-7.34.1-cp310-abi3-macosx_10_9_universal2.whl", hash = "sha256:d8b2cc79c4d8f62b293ad9b11ec3aebce9af481fa73e64556969f7345ebf9fc7"},
{file = "protobuf-7.34.1-cp310-abi3-manylinux2014_aarch64.whl", hash = "sha256:5185e0e948d07abe94bb76ec9b8416b604cfe5da6f871d67aad30cbf24c3110b"},
@@ -2116,6 +2194,7 @@ version = "0.6.3"
description = "Pure-Python implementation of ASN.1 types and DER/BER/CER codecs (X.208)"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "pyasn1-0.6.3-py3-none-any.whl", hash = "sha256:a80184d120f0864a52a073acc6fc642847d0be408e7c7252f31390c0f4eadcde"},
{file = "pyasn1-0.6.3.tar.gz", hash = "sha256:697a8ecd6d98891189184ca1fa05d1bb00e2f84b5977c481452050549c8a72cf"},
@@ -2127,6 +2206,7 @@ version = "0.4.2"
description = "A collection of ASN.1-based protocols modules"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "pyasn1_modules-0.4.2-py3-none-any.whl", hash = "sha256:29253a9207ce32b64c3ac6600edc75368f98473906e8fd1043bd6b5b1de2c14a"},
{file = "pyasn1_modules-0.4.2.tar.gz", hash = "sha256:677091de870a80aae844b1ca6134f54652fa2c8c5a52aa396440ac3106e941e6"},
@@ -2141,6 +2221,7 @@ version = "26.2.16"
description = "ISO country, subdivision, language, currency and script definitions and their translations"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "pycountry-26.2.16-py3-none-any.whl", hash = "sha256:115c4baf7cceaa30f59a4694d79483c9167dbce7a9de4d3d571c5f3ea77c305a"},
{file = "pycountry-26.2.16.tar.gz", hash = "sha256:5b6027d453fcd6060112b951dd010f01f168b51b4bf8a1f1fc8c95c8d94a0801"},
@@ -2152,6 +2233,8 @@ version = "3.0"
description = "C parser in Python"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
+markers = "platform_python_implementation != \"PyPy\" and implementation_name != \"PyPy\""
files = [
{file = "pycparser-3.0-py3-none-any.whl", hash = "sha256:b727414169a36b7d524c1c3e31839a521725078d7b2ff038656844266160a992"},
{file = "pycparser-3.0.tar.gz", hash = "sha256:600f49d217304a5902ac3c37e1281c9fe94e4d0489de643a9504c5cdfdfc6b29"},
@@ -2163,6 +2246,7 @@ version = "2.13.3"
description = "Data validation using Python type hints"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "pydantic-2.13.3-py3-none-any.whl", hash = "sha256:6db14ac8dfc9a1e57f87ea2c0de670c251240f43cb0c30a5130e9720dc612927"},
{file = "pydantic-2.13.3.tar.gz", hash = "sha256:af09e9d1d09f4e7fe37145c1f577e1d61ceb9a41924bf0094a36506285d0a84d"},
@@ -2176,7 +2260,7 @@ typing-inspection = ">=0.4.2"
[package.extras]
email = ["email-validator (>=2.0.0)"]
-timezone = ["tzdata"]
+timezone = ["tzdata ; python_version >= \"3.9\" and platform_system == \"Windows\""]
[[package]]
name = "pydantic-core"
@@ -2184,6 +2268,7 @@ version = "2.46.3"
description = "Core functionality for Pydantic validation and serialization"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "pydantic_core-2.46.3-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:1da3786b8018e60349680720158cc19161cc3b4bdd815beb0a321cd5ce1ad5b1"},
{file = "pydantic_core-2.46.3-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:cc0988cb29d21bf4a9d5cf2ef970b5c0e38d8d8e107a493278c05dc6c1dda69f"},
@@ -2316,6 +2401,7 @@ version = "2.20.0"
description = "Pygments is a syntax highlighting package written in Python."
optional = false
python-versions = ">=3.9"
+groups = ["main", "dev"]
files = [
{file = "pygments-2.20.0-py3-none-any.whl", hash = "sha256:81a9e26dd42fd28a23a2d169d86d7ac03b46e2f8b59ed4698fb4785f946d0176"},
{file = "pygments-2.20.0.tar.gz", hash = "sha256:6757cd03768053ff99f3039c1a36d6c0aa0b263438fcab17520b30a303a82b5f"},
@@ -2330,14 +2416,12 @@ version = "2.12.1"
description = "JSON Web Token implementation in Python"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "pyjwt-2.12.1-py3-none-any.whl", hash = "sha256:28ca37c070cad8ba8cd9790cd940535d40274d22f80ab87f3ac6a713e6e8454c"},
{file = "pyjwt-2.12.1.tar.gz", hash = "sha256:c74a7a2adf861c04d002db713dd85f84beb242228e671280bf709d765b03672b"},
]
-[package.dependencies]
-typing_extensions = {version = ">=4.0", markers = "python_version < \"3.11\""}
-
[package.extras]
crypto = ["cryptography (>=3.4.0)"]
dev = ["coverage[toml] (==7.10.7)", "cryptography (>=3.4.0)", "pre-commit", "pytest (>=8.4.2,<9.0.0)", "sphinx", "sphinx-rtd-theme", "zope.interface"]
@@ -2350,6 +2434,7 @@ version = "3.1.1"
description = "Python Rate-Limiter using Leaky-Bucket Algorithm"
optional = false
python-versions = ">=3.8,<4.0"
+groups = ["main"]
files = [
{file = "pyrate_limiter-3.1.1-py3-none-any.whl", hash = "sha256:c51906f1d51d56dc992ff6c26e8300e32151bc6cfa3e6559792e31971dfd4e2b"},
{file = "pyrate_limiter-3.1.1.tar.gz", hash = "sha256:2f57eda712687e6eccddf6afe8f8a15b409b97ed675fe64a626058f12863b7b7"},
@@ -2365,6 +2450,7 @@ version = "8.4.2"
description = "pytest: simple powerful testing with Python"
optional = false
python-versions = ">=3.9"
+groups = ["dev"]
files = [
{file = "pytest-8.4.2-py3-none-any.whl", hash = "sha256:872f880de3fc3a5bdc88a11b39c9710c3497a547cfa9320bc3c5e62fbf272e79"},
{file = "pytest-8.4.2.tar.gz", hash = "sha256:86c0d0b93306b961d58d62a4db4879f27fe25513d4b969df351abdddb3c30e01"},
@@ -2372,12 +2458,10 @@ files = [
[package.dependencies]
colorama = {version = ">=0.4", markers = "sys_platform == \"win32\""}
-exceptiongroup = {version = ">=1", markers = "python_version < \"3.11\""}
iniconfig = ">=1"
packaging = ">=20"
pluggy = ">=1.5,<2"
pygments = ">=2.7.2"
-tomli = {version = ">=1", markers = "python_version < \"3.11\""}
[package.extras]
dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "requests", "setuptools", "xmlschema"]
@@ -2388,6 +2472,7 @@ version = "3.15.1"
description = "Thin-wrapper around the mock package for easier use with pytest"
optional = false
python-versions = ">=3.9"
+groups = ["dev"]
files = [
{file = "pytest_mock-3.15.1-py3-none-any.whl", hash = "sha256:0a25e2eb88fe5168d535041d09a4529a188176ae608a6d249ee65abc0949630d"},
{file = "pytest_mock-3.15.1.tar.gz", hash = "sha256:1849a238f6f396da19762269de72cb1814ab44416fa73a8686deac10b0d87a0f"},
@@ -2405,6 +2490,7 @@ version = "2.9.0.post0"
description = "Extensions to the standard Python datetime module"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
+groups = ["main", "dev"]
files = [
{file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"},
{file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"},
@@ -2419,6 +2505,7 @@ version = "3.1.0"
description = "Universally unique lexicographically sortable identifier"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "python_ulid-3.1.0-py3-none-any.whl", hash = "sha256:e2cdc979c8c877029b4b7a38a6fba3bc4578e4f109a308419ff4d3ccf0a46619"},
{file = "python_ulid-3.1.0.tar.gz", hash = "sha256:ff0410a598bc5f6b01b602851a3296ede6f91389f913a5d5f8c496003836f636"},
@@ -2433,6 +2520,7 @@ version = "2024.2"
description = "World timezone definitions, modern and historical"
optional = false
python-versions = "*"
+groups = ["main"]
files = [
{file = "pytz-2024.2-py2.py3-none-any.whl", hash = "sha256:31c7c1817eb7fae7ca4b8c7ee50c72f93aa2dd863de768e1ef4245d426aa0725"},
{file = "pytz-2024.2.tar.gz", hash = "sha256:2aa355083c50a0f93fa581709deac0c9ad65cca8a9e9beac660adcbd493c798a"},
@@ -2444,6 +2532,7 @@ version = "6.0.3"
description = "YAML parser and emitter for Python"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "PyYAML-6.0.3-cp38-cp38-macosx_10_13_x86_64.whl", hash = "sha256:c2514fceb77bc5e7a2f7adfaa1feb2fb311607c9cb518dbc378688ec73d8292f"},
{file = "PyYAML-6.0.3-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:9c57bb8c96f6d1808c030b1687b9b5fb476abaa47f0db9c0101f5e9f394e97f4"},
@@ -2526,6 +2615,7 @@ version = "3.14.5"
description = "rapid fuzzy string matching"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "rapidfuzz-3.14.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:071d96b957a33b9296b9284b6350a0fb6d030b154a04efd7c15e56b98b79a517"},
{file = "rapidfuzz-3.14.5-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:667f40fe9c81ad129b198d236881b00dd9e8314d9cc72d03c3e16bdfe5879051"},
@@ -2621,6 +2711,7 @@ version = "0.37.0"
description = "JSON Referencing + Python"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "referencing-0.37.0-py3-none-any.whl", hash = "sha256:381329a9f99628c9069361716891d34ad94af76e461dcb0335825aecc7692231"},
{file = "referencing-0.37.0.tar.gz", hash = "sha256:44aefc3142c5b842538163acb373e24cce6632bd54bdb01b21ad5863489f50d8"},
@@ -2637,6 +2728,7 @@ version = "2026.4.4"
description = "Alternative regular expression module, to replace re."
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "regex-2026.4.4-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:74fa82dcc8143386c7c0392e18032009d1db715c25f4ba22d23dc2e04d02a20f"},
{file = "regex-2026.4.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a85b620a388d6c9caa12189233109e236b3da3deffe4ff11b84ae84e218a274f"},
@@ -2760,6 +2852,7 @@ version = "2.33.1"
description = "Python HTTP for Humans."
optional = false
python-versions = ">=3.10"
+groups = ["main", "dev"]
files = [
{file = "requests-2.33.1-py3-none-any.whl", hash = "sha256:4e6d1ef462f3626a1f0a0a9c42dd93c63bad33f9f1c1937509b8c5c8718ab56a"},
{file = "requests-2.33.1.tar.gz", hash = "sha256:18817f8c57c6263968bc123d237e3b8b08ac046f5456bd1e307ee8f4250d3517"},
@@ -2781,6 +2874,7 @@ version = "1.3.1"
description = "A persistent cache for python requests"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "requests_cache-1.3.1-py3-none-any.whl", hash = "sha256:43a67448c3b2964c631ac7027b84607f2f63438e28104b68ad2211f32d9f606c"},
{file = "requests_cache-1.3.1.tar.gz", hash = "sha256:784e9d07f72db4fe234830a065230c59eb446489528f271ba288c640897e47c4"},
@@ -2808,6 +2902,7 @@ version = "1.12.1"
description = "Mock out responses from the requests package"
optional = false
python-versions = ">=3.5"
+groups = ["dev"]
files = [
{file = "requests-mock-1.12.1.tar.gz", hash = "sha256:e9e12e333b525156e82a3c852f22016b9158220d2f47454de9cae8a77d371401"},
{file = "requests_mock-1.12.1-py2.py3-none-any.whl", hash = "sha256:b1e37054004cdd5e56c84454cc7df12b25f90f382159087f4b6915aaeef39563"},
@@ -2825,6 +2920,7 @@ version = "15.0.0"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
optional = false
python-versions = ">=3.9.0"
+groups = ["main"]
files = [
{file = "rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb"},
{file = "rich-15.0.0.tar.gz", hash = "sha256:edd07a4824c6b40189fb7ac9bc4c52536e9780fbbfbddf6f1e2502c31b068c36"},
@@ -2843,6 +2939,7 @@ version = "1.9.7"
description = "Format click help output nicely with rich"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "rich_click-1.9.7-py3-none-any.whl", hash = "sha256:2f99120fca78f536e07b114d3b60333bc4bb2a0969053b1250869bcdc1b5351b"},
{file = "rich_click-1.9.7.tar.gz", hash = "sha256:022997c1e30731995bdbc8ec2f82819340d42543237f033a003c7b1f843fc5dc"},
@@ -2852,11 +2949,10 @@ files = [
click = ">=8"
colorama = {version = "*", markers = "platform_system == \"Windows\""}
rich = ">=12"
-typing-extensions = {version = ">=4", markers = "python_version < \"3.11\""}
[package.extras]
dev = ["inline-snapshot (>=0.24)", "jsonschema (>=4)", "mypy (>=1.14.1)", "nodeenv (>=1.9.1)", "packaging (>=25)", "pre-commit (>=3.5)", "pytest (>=8.3.5)", "pytest-cov (>=5)", "rich-codex (>=1.2.11)", "ruff (>=0.12.4)", "typer (>=0.15)", "types-setuptools (>=75.8.0.20250110)"]
-docs = ["markdown-include (>=0.8.1)", "mike (>=2.1.3)", "mkdocs-github-admonitions-plugin (>=0.1.1)", "mkdocs-glightbox (>=0.4)", "mkdocs-include-markdown-plugin (>=7.1.7)", "mkdocs-material-extensions (>=1.3.1)", "mkdocs-material[imaging] (>=9.5.18,<9.6.0)", "mkdocs-redirects (>=1.2.2)", "mkdocs-rss-plugin (>=1.15)", "mkdocs[docs] (>=1.6.1)", "mkdocstrings[python] (>=0.26.1)", "rich-codex (>=1.2.11)", "typer (>=0.15)"]
+docs = ["markdown-include (>=0.8.1)", "mike (>=2.1.3)", "mkdocs-github-admonitions-plugin (>=0.1.1)", "mkdocs-glightbox (>=0.4)", "mkdocs-include-markdown-plugin (>=7.1.7) ; python_version >= \"3.9\"", "mkdocs-material-extensions (>=1.3.1)", "mkdocs-material[imaging] (>=9.5.18,<9.6.0)", "mkdocs-redirects (>=1.2.2)", "mkdocs-rss-plugin (>=1.15)", "mkdocs[docs] (>=1.6.1)", "mkdocstrings[python] (>=0.26.1)", "rich-codex (>=1.2.11)", "typer (>=0.15)"]
[[package]]
name = "rpds-py"
@@ -2864,6 +2960,7 @@ version = "0.30.0"
description = "Python bindings to Rust's persistent data structures (rpds)"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "rpds_py-0.30.0-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:679ae98e00c0e8d68a7fda324e16b90fd5260945b45d3b824c892cec9eea3288"},
{file = "rpds_py-0.30.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:4cc2206b76b4f576934f0ed374b10d7ca5f457858b157ca52064bdfc26b9fc00"},
@@ -2988,6 +3085,7 @@ version = "1.20.0"
description = ""
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "serpyco_rs-1.20.0-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:9672de723ca13a7d19cbe79debcb1b15e29abb939fbf853647dd4c2eac2814e1"},
{file = "serpyco_rs-1.20.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8faa295f2e7e32bd502243f8880963d5d5405bbf95205ed4fca75d8da632ff96"},
@@ -3050,19 +3148,20 @@ version = "80.10.2"
description = "Easily download, build, install, upgrade, and uninstall Python packages"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "setuptools-80.10.2-py3-none-any.whl", hash = "sha256:95b30ddfb717250edb492926c92b5221f7ef3fbcc2b07579bcd4a27da21d0173"},
{file = "setuptools-80.10.2.tar.gz", hash = "sha256:8b0e9d10c784bf7d262c4e5ec5d4ec94127ce206e8738f29a437945fbc219b70"},
]
[package.extras]
-check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1)", "ruff (>=0.8.0)"]
-core = ["importlib_metadata (>=6)", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1)", "wheel (>=0.43.0)"]
+check = ["pytest-checkdocs (>=2.4)", "pytest-ruff (>=0.2.1) ; sys_platform != \"cygwin\"", "ruff (>=0.8.0) ; sys_platform != \"cygwin\""]
+core = ["importlib_metadata (>=6) ; python_version < \"3.10\"", "jaraco.functools (>=4)", "jaraco.text (>=3.7)", "more_itertools", "more_itertools (>=8.8)", "packaging (>=24.2)", "platformdirs (>=4.2.2)", "tomli (>=2.0.1) ; python_version < \"3.11\"", "wheel (>=0.43.0)"]
cover = ["pytest-cov"]
doc = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "pyproject-hooks (!=1.1)", "rst.linker (>=1.9)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier", "towncrier (<24.7)"]
enabler = ["pytest-enabler (>=2.2)"]
-test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.7.2)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"]
-type = ["importlib_metadata (>=7.0.2)", "jaraco.develop (>=7.21)", "mypy (==1.14.*)", "pytest-mypy"]
+test = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "ini2toml[lite] (>=0.14)", "jaraco.develop (>=7.21) ; python_version >= \"3.9\" and sys_platform != \"cygwin\"", "jaraco.envs (>=2.2)", "jaraco.path (>=3.7.2)", "jaraco.test (>=5.5)", "packaging (>=24.2)", "pip (>=19.1)", "pyproject-hooks (!=1.1)", "pytest (>=6,!=8.1.*)", "pytest-home (>=0.5)", "pytest-perf ; sys_platform != \"cygwin\"", "pytest-subprocess", "pytest-timeout", "pytest-xdist (>=3)", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel (>=0.44.0)"]
+type = ["importlib_metadata (>=7.0.2) ; python_version < \"3.10\"", "jaraco.develop (>=7.21) ; sys_platform != \"cygwin\"", "mypy (==1.14.*)", "pytest-mypy"]
[[package]]
name = "six"
@@ -3070,73 +3169,19 @@ version = "1.17.0"
description = "Python 2 and 3 compatibility utilities"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
+groups = ["main", "dev"]
files = [
{file = "six-1.17.0-py2.py3-none-any.whl", hash = "sha256:4721f391ed90541fddacab5acf947aa0d3dc7d27b2e1e8eda2be8970586c3274"},
{file = "six-1.17.0.tar.gz", hash = "sha256:ff70335d468e7eb6ec65b95b99d3a2836546063f63acc5171de367e834932a81"},
]
-[[package]]
-name = "tomli"
-version = "2.4.1"
-description = "A lil' TOML parser"
-optional = false
-python-versions = ">=3.8"
-files = [
- {file = "tomli-2.4.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:f8f0fc26ec2cc2b965b7a3b87cd19c5c6b8c5e5f436b984e85f486d652285c30"},
- {file = "tomli-2.4.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:4ab97e64ccda8756376892c53a72bd1f964e519c77236368527f758fbc36a53a"},
- {file = "tomli-2.4.1-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:96481a5786729fd470164b47cdb3e0e58062a496f455ee41b4403be77cb5a076"},
- {file = "tomli-2.4.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:5a881ab208c0baf688221f8cecc5401bd291d67e38a1ac884d6736cbcd8247e9"},
- {file = "tomli-2.4.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:47149d5bd38761ac8be13a84864bf0b7b70bc051806bc3669ab1cbc56216b23c"},
- {file = "tomli-2.4.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:ec9bfaf3ad2df51ace80688143a6a4ebc09a248f6ff781a9945e51937008fcbc"},
- {file = "tomli-2.4.1-cp311-cp311-win32.whl", hash = "sha256:ff2983983d34813c1aeb0fa89091e76c3a22889ee83ab27c5eeb45100560c049"},
- {file = "tomli-2.4.1-cp311-cp311-win_amd64.whl", hash = "sha256:5ee18d9ebdb417e384b58fe414e8d6af9f4e7a0ae761519fb50f721de398dd4e"},
- {file = "tomli-2.4.1-cp311-cp311-win_arm64.whl", hash = "sha256:c2541745709bad0264b7d4705ad453b76ccd191e64aa6f0fc66b69a293a45ece"},
- {file = "tomli-2.4.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:c742f741d58a28940ce01d58f0ab2ea3ced8b12402f162f4d534dfe18ba1cd6a"},
- {file = "tomli-2.4.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:7f86fd587c4ed9dd76f318225e7d9b29cfc5a9d43de44e5754db8d1128487085"},
- {file = "tomli-2.4.1-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:ff18e6a727ee0ab0388507b89d1bc6a22b138d1e2fa56d1ad494586d61d2eae9"},
- {file = "tomli-2.4.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:136443dbd7e1dee43c68ac2694fde36b2849865fa258d39bf822c10e8068eac5"},
- {file = "tomli-2.4.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:5e262d41726bc187e69af7825504c933b6794dc3fbd5945e41a79bb14c31f585"},
- {file = "tomli-2.4.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:5cb41aa38891e073ee49d55fbc7839cfdb2bc0e600add13874d048c94aadddd1"},
- {file = "tomli-2.4.1-cp312-cp312-win32.whl", hash = "sha256:da25dc3563bff5965356133435b757a795a17b17d01dbc0f42fb32447ddfd917"},
- {file = "tomli-2.4.1-cp312-cp312-win_amd64.whl", hash = "sha256:52c8ef851d9a240f11a88c003eacb03c31fc1c9c4ec64a99a0f922b93874fda9"},
- {file = "tomli-2.4.1-cp312-cp312-win_arm64.whl", hash = "sha256:f758f1b9299d059cc3f6546ae2af89670cb1c4d48ea29c3cacc4fe7de3058257"},
- {file = "tomli-2.4.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:36d2bd2ad5fb9eaddba5226aa02c8ec3fa4f192631e347b3ed28186d43be6b54"},
- {file = "tomli-2.4.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:eb0dc4e38e6a1fd579e5d50369aa2e10acfc9cace504579b2faabb478e76941a"},
- {file = "tomli-2.4.1-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:c7f2c7f2b9ca6bdeef8f0fa897f8e05085923eb091721675170254cbc5b02897"},
- {file = "tomli-2.4.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:f3c6818a1a86dd6dca7ddcaaf76947d5ba31aecc28cb1b67009a5877c9a64f3f"},
- {file = "tomli-2.4.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:d312ef37c91508b0ab2cee7da26ec0b3ed2f03ce12bd87a588d771ae15dcf82d"},
- {file = "tomli-2.4.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:51529d40e3ca50046d7606fa99ce3956a617f9b36380da3b7f0dd3dd28e68cb5"},
- {file = "tomli-2.4.1-cp313-cp313-win32.whl", hash = "sha256:2190f2e9dd7508d2a90ded5ed369255980a1bcdd58e52f7fe24b8162bf9fedbd"},
- {file = "tomli-2.4.1-cp313-cp313-win_amd64.whl", hash = "sha256:8d65a2fbf9d2f8352685bc1364177ee3923d6baf5e7f43ea4959d7d8bc326a36"},
- {file = "tomli-2.4.1-cp313-cp313-win_arm64.whl", hash = "sha256:4b605484e43cdc43f0954ddae319fb75f04cc10dd80d830540060ee7cd0243cd"},
- {file = "tomli-2.4.1-cp314-cp314-macosx_10_15_x86_64.whl", hash = "sha256:fd0409a3653af6c147209d267a0e4243f0ae46b011aa978b1080359fddc9b6cf"},
- {file = "tomli-2.4.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:a120733b01c45e9a0c34aeef92bf0cf1d56cfe81ed9d47d562f9ed591a9828ac"},
- {file = "tomli-2.4.1-cp314-cp314-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:559db847dc486944896521f68d8190be1c9e719fced785720d2216fe7022b662"},
- {file = "tomli-2.4.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:01f520d4f53ef97964a240a035ec2a869fe1a37dde002b57ebc4417a27ccd853"},
- {file = "tomli-2.4.1-cp314-cp314-musllinux_1_2_aarch64.whl", hash = "sha256:7f94b27a62cfad8496c8d2513e1a222dd446f095fca8987fceef261225538a15"},
- {file = "tomli-2.4.1-cp314-cp314-musllinux_1_2_x86_64.whl", hash = "sha256:ede3e6487c5ef5d28634ba3f31f989030ad6af71edfb0055cbbd14189ff240ba"},
- {file = "tomli-2.4.1-cp314-cp314-win32.whl", hash = "sha256:3d48a93ee1c9b79c04bb38772ee1b64dcf18ff43085896ea460ca8dec96f35f6"},
- {file = "tomli-2.4.1-cp314-cp314-win_amd64.whl", hash = "sha256:88dceee75c2c63af144e456745e10101eb67361050196b0b6af5d717254dddf7"},
- {file = "tomli-2.4.1-cp314-cp314-win_arm64.whl", hash = "sha256:b8c198f8c1805dc42708689ed6864951fd2494f924149d3e4bce7710f8eb5232"},
- {file = "tomli-2.4.1-cp314-cp314t-macosx_10_15_x86_64.whl", hash = "sha256:d4d8fe59808a54658fcc0160ecfb1b30f9089906c50b23bcb4c69eddc19ec2b4"},
- {file = "tomli-2.4.1-cp314-cp314t-macosx_11_0_arm64.whl", hash = "sha256:7008df2e7655c495dd12d2a4ad038ff878d4ca4b81fccaf82b714e07eae4402c"},
- {file = "tomli-2.4.1-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:1d8591993e228b0c930c4bb0db464bdad97b3289fb981255d6c9a41aedc84b2d"},
- {file = "tomli-2.4.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:734e20b57ba95624ecf1841e72b53f6e186355e216e5412de414e3c51e5e3c41"},
- {file = "tomli-2.4.1-cp314-cp314t-musllinux_1_2_aarch64.whl", hash = "sha256:8a650c2dbafa08d42e51ba0b62740dae4ecb9338eefa093aa5c78ceb546fcd5c"},
- {file = "tomli-2.4.1-cp314-cp314t-musllinux_1_2_x86_64.whl", hash = "sha256:504aa796fe0569bb43171066009ead363de03675276d2d121ac1a4572397870f"},
- {file = "tomli-2.4.1-cp314-cp314t-win32.whl", hash = "sha256:b1d22e6e9387bf4739fbe23bfa80e93f6b0373a7f1b96c6227c32bef95a4d7a8"},
- {file = "tomli-2.4.1-cp314-cp314t-win_amd64.whl", hash = "sha256:2c1c351919aca02858f740c6d33adea0c5deea37f9ecca1cc1ef9e884a619d26"},
- {file = "tomli-2.4.1-cp314-cp314t-win_arm64.whl", hash = "sha256:eab21f45c7f66c13f2a9e0e1535309cee140182a9cdae1e041d02e47291e8396"},
- {file = "tomli-2.4.1-py3-none-any.whl", hash = "sha256:0d85819802132122da43cb86656f8d1f8c6587d54ae7dcaf30e90533028b49fe"},
- {file = "tomli-2.4.1.tar.gz", hash = "sha256:7c7e1a961a0b2f2472c1ac5b69affa0ae1132c39adcb67aba98568702b9cc23f"},
-]
-
[[package]]
name = "tqdm"
version = "4.67.3"
description = "Fast, Extensible Progress Meter"
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "tqdm-4.67.3-py3-none-any.whl", hash = "sha256:ee1e4c0e59148062281c49d80b25b67771a127c85fc9676d3be5f243206826bf"},
{file = "tqdm-4.67.3.tar.gz", hash = "sha256:7d825f03f89244ef73f1d4ce193cb1774a8179fd96f31d7e1dcde62092b960bb"},
@@ -3158,6 +3203,7 @@ version = "4.15.0"
description = "Backported and Experimental Type Hints for Python 3.9+"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "typing_extensions-4.15.0-py3-none-any.whl", hash = "sha256:f0fa19c6845758ab08074a0cfa8b7aecb71c999ca73d62883bc25cc018c4e548"},
{file = "typing_extensions-4.15.0.tar.gz", hash = "sha256:0cea48d173cc12fa28ecabc3b837ea3cf6f38c6d1136f85cbaaf598984861466"},
@@ -3169,6 +3215,7 @@ version = "0.4.2"
description = "Runtime typing introspection tools"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "typing_inspection-0.4.2-py3-none-any.whl", hash = "sha256:4ed1cacbdc298c220f1bd249ed5287caa16f34d44ef4e9c3d0cbad5b521545e7"},
{file = "typing_inspection-0.4.2.tar.gz", hash = "sha256:ba561c48a67c5958007083d386c3295464928b01faa735ab8547c5692e87f464"},
@@ -3183,6 +3230,7 @@ version = "2026.2"
description = "Provider of IANA time zone data"
optional = false
python-versions = ">=2"
+groups = ["main"]
files = [
{file = "tzdata-2026.2-py2.py3-none-any.whl", hash = "sha256:bbe9af844f658da81a5f95019480da3a89415801f6cc966806612cc7169bffe7"},
{file = "tzdata-2026.2.tar.gz", hash = "sha256:9173fde7d80d9018e02a662e168e5a2d04f87c41ea174b139fbef642eda62d10"},
@@ -3194,6 +3242,7 @@ version = "5.3.1"
description = "tzinfo object for the local timezone"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "tzlocal-5.3.1-py3-none-any.whl", hash = "sha256:eb1a66c3ef5847adf7a834f1be0800581b683b5608e74f86ecbcef8ab91bb85d"},
{file = "tzlocal-5.3.1.tar.gz", hash = "sha256:cceffc7edecefea1f595541dbd6e990cb1ea3d19bf01b2809f362a03dd7921fd"},
@@ -3211,6 +3260,7 @@ version = "1.4.0"
description = "ASCII transliterations of Unicode text"
optional = false
python-versions = ">=3.7"
+groups = ["main"]
files = [
{file = "Unidecode-1.4.0-py3-none-any.whl", hash = "sha256:c3c7606c27503ad8d501270406e345ddb480a7b5f38827eafe4fa82a137f0021"},
{file = "Unidecode-1.4.0.tar.gz", hash = "sha256:ce35985008338b676573023acc382d62c264f307c8f7963733405add37ea2b23"},
@@ -3222,6 +3272,7 @@ version = "2.2.1"
description = "URL normalization for Python"
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "url_normalize-2.2.1-py3-none-any.whl", hash = "sha256:3deb687587dc91f7b25c9ae5162ffc0f057ae85d22b1e15cf5698311247f567b"},
{file = "url_normalize-2.2.1.tar.gz", hash = "sha256:74a540a3b6eba1d95bdc610c24f2c0141639f3ba903501e61a52a8730247ff37"},
@@ -3239,16 +3290,17 @@ version = "2.6.3"
description = "HTTP library with thread-safe connection pooling, file post, and more."
optional = false
python-versions = ">=3.9"
+groups = ["main", "dev"]
files = [
{file = "urllib3-2.6.3-py3-none-any.whl", hash = "sha256:bf272323e553dfb2e87d9bfd225ca7b0f467b919d7bbd355436d3fd37cb0acd4"},
{file = "urllib3-2.6.3.tar.gz", hash = "sha256:1b62b6884944a57dbe321509ab94fd4d3b307075e0c2eae991ac71ee15ad38ed"},
]
[package.extras]
-brotli = ["brotli (>=1.2.0)", "brotlicffi (>=1.2.0.0)"]
+brotli = ["brotli (>=1.2.0) ; platform_python_implementation == \"CPython\"", "brotlicffi (>=1.2.0.0) ; platform_python_implementation != \"CPython\""]
h2 = ["h2 (>=4,<5)"]
socks = ["pysocks (>=1.5.6,!=1.5.7,<2.0)"]
-zstd = ["backports-zstd (>=1.0.0)"]
+zstd = ["backports-zstd (>=1.0.0) ; python_version < \"3.14\""]
[[package]]
name = "wcmatch"
@@ -3256,6 +3308,7 @@ version = "10.0"
description = "Wildcard/glob file name matcher."
optional = false
python-versions = ">=3.8"
+groups = ["main"]
files = [
{file = "wcmatch-10.0-py3-none-any.whl", hash = "sha256:0dd927072d03c0a6527a20d2e6ad5ba8d0380e60870c383bc533b71744df7b7a"},
{file = "wcmatch-10.0.tar.gz", hash = "sha256:e72f0de09bba6a04e0de70937b0cf06e55f36f37b3deb422dfaf854b867b840a"},
@@ -3270,6 +3323,7 @@ version = "0.8.10"
description = "Modern datetime library for Python"
optional = false
python-versions = ">=3.9"
+groups = ["main"]
files = [
{file = "whenever-0.8.10-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:d9ecb6b649cb7e5c85742f626ddd56d5cf5d276c632a47ec5d72714350300564"},
{file = "whenever-0.8.10-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:0698cbd2209413f7a0cb84507405587e7b3995ce22504e50477a1a65ec3b65b9"},
@@ -3368,6 +3422,7 @@ version = "0.14.2"
description = "Makes working with XML feel like you are working with JSON"
optional = false
python-versions = ">=3.6"
+groups = ["main"]
files = [
{file = "xmltodict-0.14.2-py2.py3-none-any.whl", hash = "sha256:20cc7d723ed729276e808f26fb6b3599f786cbc37e06c65e192ba77c40f20aac"},
{file = "xmltodict-0.14.2.tar.gz", hash = "sha256:201e7c28bb210e374999d1dde6382923ab0ed1a8a5faeece48ab525b7810a553"},
@@ -3379,6 +3434,7 @@ version = "1.23.0"
description = "Yet another URL library"
optional = false
python-versions = ">=3.10"
+groups = ["main"]
files = [
{file = "yarl-1.23.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:cff6d44cb13d39db2663a22b22305d10855efa0fa8015ddeacc40bc59b9d8107"},
{file = "yarl-1.23.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:e4c53f8347cd4200f0d70a48ad059cabaf24f5adc6ba08622a23423bc7efa10d"},
@@ -3516,6 +3572,6 @@ multidict = ">=4.0"
propcache = ">=0.2.1"
[metadata]
-lock-version = "2.0"
-python-versions = "^3.10,<3.12"
-content-hash = "e7f942cebc10a2fdd4242aeaa3024553d34e5e3c830f09655a072b2b1b5604d8"
+lock-version = "2.1"
+python-versions = "^3.11,<3.14"
+content-hash = "8e488d942c5f2849c8d5ea5ffbce2c3b46b3d2be794387fc886f6ee41c4d8631"
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/pyproject.toml b/airbyte-integrations/connectors/source-facebook-marketing/pyproject.toml
index e64e0934591d..d7a19180f4a5 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/pyproject.toml
+++ b/airbyte-integrations/connectors/source-facebook-marketing/pyproject.toml
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
-version = "5.3.1"
+version = "6.2.0"
name = "source-facebook-marketing"
description = "Source implementation for Facebook Marketing."
authors = [ "Airbyte ",]
@@ -16,8 +16,8 @@ repository = "https://github.com/airbytehq/airbyte"
include = "source_facebook_marketing"
[tool.poetry.dependencies]
-python = "^3.10,<3.12"
-airbyte-cdk = "^7.17.4"
+python = "^3.11,<3.14"
+airbyte-cdk = "^7.45.0"
facebook-business = "^25.0.0"
cached-property = "^2"
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py
index a8e74ecc34c7..5c660e901158 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/api.py
@@ -14,7 +14,7 @@
from facebook_business.api import FacebookResponse
from facebook_business.exceptions import FacebookRequestError
-from source_facebook_marketing.streams.common import retry_pattern
+from source_facebook_marketing.streams.common import FACEBOOK_RATE_LIMIT_ERROR_CODES, TRANSIENT_NETWORK_EXCEPTIONS, retry_pattern
logger = logging.getLogger("airbyte")
@@ -24,7 +24,7 @@ class FacebookAPIException(Exception):
"""General class for all API errors"""
-backoff_policy = retry_pattern(backoff.expo, FacebookRequestError, max_tries=5, factor=5)
+backoff_policy = retry_pattern(backoff.expo, (FacebookRequestError, *TRANSIENT_NETWORK_EXCEPTIONS), max_tries=5, factor=5)
class MyFacebookAdsApi(FacebookAdsApi):
@@ -33,11 +33,31 @@ class MyFacebookAdsApi(FacebookAdsApi):
MAX_RATE, MAX_PAUSE_INTERVAL = (95, timedelta(minutes=10))
MIN_RATE, MIN_PAUSE_INTERVAL = (85, timedelta(minutes=2))
+ # Graph API error codes that mean the ad account/app is locked out until a quota block clears,
+ # rather than a transient failure the generic expo backoff can retry through. Value is the set
+ # of error_subcodes that qualify for that code. Only codes backed by production evidence are
+ # enabled here; other known rate-limit codes (4 app-level, 80000-80004 business use case, 613
+ # custom rate limit) can be added the same way once they're observed to need this treatment.
+ QUOTA_BLOCK_ERROR_CODES = {
+ 17: {2446079}, # "Ad Account Has Too Many API Calls"
+ }
+
+ # Observed quota blocks lasted up to an hour. Cap the cumulative wait on one block episode so a
+ # block that never clears still surfaces as a failure -- through the unchanged backoff/give-up
+ # path -- instead of holding the worker forever.
+ MAX_QUOTA_BLOCK_WAIT = timedelta(hours=1)
+
# see `_should_restore_page_size` method docstring for more info.
# attribute to handle the reduced request limit
request_record_limit_is_reduced: bool = False
# attribute to save the status of the last successful call
last_api_call_is_successful: bool = False
+ # cumulative quota-block wait of the current block episode; kept on the instance so it survives
+ # @backoff_policy re-entering `call()`, reset by the next successful call
+ _quota_block_wait_elapsed: timedelta = timedelta()
+ # the connection check turns this off: the platform fails a check that has not finished within 9 minutes
+ # (total run time), so waiting out a rate limit there only replaces the connector's error with a platform timeout
+ pause_on_rate_limit: bool = True
@dataclass
class Throttle:
@@ -65,6 +85,8 @@ def _parse_call_rate_header(headers):
if usage_header_ad_account:
usage_header_ad_account_loaded = json.loads(usage_header_ad_account)
usage = max(usage, float(usage_header_ad_account_loaded.get("acc_id_util_pct", 0)))
+ # seconds until the ad-account score resets - the wait hint for the account-level limit
+ pause_interval = max(pause_interval, timedelta(seconds=float(usage_header_ad_account_loaded.get("reset_time_duration", 0))))
if usage_header_app:
usage_header_app_loaded = json.loads(usage_header_app)
@@ -78,17 +100,18 @@ def _parse_call_rate_header(headers):
if usage_header_business:
usage_header_business_loaded = json.loads(usage_header_business)
for business_object_id in usage_header_business_loaded:
- usage_limits = usage_header_business_loaded.get(business_object_id)[0]
- usage = max(
- usage,
- float(usage_limits.get("call_count", 0)),
- float(usage_limits.get("total_cputime", 0)),
- float(usage_limits.get("total_time", 0)),
- )
- pause_interval = max(
- pause_interval,
- timedelta(minutes=usage_limits.get("estimated_time_to_regain_access", 0)),
- )
+ # one entry per rate-limit type (ads_management, ads_insights, ...): take the worst of them
+ for usage_limits in usage_header_business_loaded.get(business_object_id) or []:
+ usage = max(
+ usage,
+ float(usage_limits.get("call_count", 0)),
+ float(usage_limits.get("total_cputime", 0)),
+ float(usage_limits.get("total_time", 0)),
+ )
+ pause_interval = max(
+ pause_interval,
+ timedelta(minutes=usage_limits.get("estimated_time_to_regain_access", 0)),
+ )
return usage, pause_interval
@@ -118,6 +141,12 @@ def _get_max_usage_pause_interval_from_batch(self, records):
pause_interval = max(pause_interval_from_response, pause_interval)
return usage, pause_interval
+ def _pause_if_usage_high(self, usage, pause_interval):
+ if self.pause_on_rate_limit and usage >= self.MIN_RATE:
+ sleep_time = self._compute_pause_interval(usage=usage, pause_interval=pause_interval)
+ logger.warning(f"Facebook API Utilization is too high ({usage})%, pausing for {sleep_time}")
+ sleep(sleep_time.total_seconds())
+
def _handle_call_rate_limit(self, response, params):
if "batch" in params:
records = response.json()
@@ -126,10 +155,37 @@ def _handle_call_rate_limit(self, response, params):
headers = response.headers()
usage, pause_interval = self._parse_call_rate_header(headers)
- if usage >= self.MIN_RATE:
- sleep_time = self._compute_pause_interval(usage=usage, pause_interval=pause_interval)
- logger.warning(f"Facebook API Utilization is too high ({usage})%, pausing for {sleep_time}")
- sleep(sleep_time.total_seconds())
+ self._pause_if_usage_high(usage, pause_interval)
+
+ def _is_quota_block_error(self, exc: FacebookRequestError) -> bool:
+ """A quota block (e.g. code 17 / 2446079, "Ad Account Has Too Many API Calls") means the
+ account is locked out until the block clears -- retrying it on the generic expo backoff
+ ladder just spends more rejected calls inside that same window."""
+ subcodes = self.QUOTA_BLOCK_ERROR_CODES.get(exc.api_error_code())
+ return subcodes is not None and exc.api_error_subcode() in subcodes
+
+ def _handle_quota_block_error(self, exc: FacebookRequestError) -> timedelta:
+ """A quota block's own response usually carries `estimated_time_to_regain_access`; wait
+ that long instead of the ~75s expo ladder, capped at MAX_PAUSE_INTERVAL since a block can
+ last up to an hour and re-checking is better than sleeping through it in one shot. Fall
+ back to MAX_PAUSE_INTERVAL when the field isn't present. Returns the wait applied, so the
+ caller can bound how long it keeps retrying."""
+ _, pause_interval = self._parse_call_rate_header(exc.http_headers())
+ wait = min(pause_interval, self.MAX_PAUSE_INTERVAL) if pause_interval else self.MAX_PAUSE_INTERVAL
+ logger.warning(
+ f"Facebook API quota block (code={exc.api_error_code()}, subcode={exc.api_error_subcode()}); "
+ f"pausing for {wait} before retrying ({self._quota_block_wait_elapsed + wait} of {self.MAX_QUOTA_BLOCK_WAIT} wait budget used)"
+ )
+ sleep(wait.total_seconds())
+ return wait
+
+ def _handle_failed_call_rate_limit(self, exc: FacebookRequestError):
+ """The rate-limit signal lives in the response headers, which for a failed call are only
+ reachable through the raised exception -- mirrors `_handle_call_rate_limit` so a failing
+ call gets the same utilization-based pause a successful one would. Capped at
+ MAX_PAUSE_INTERVAL because @backoff_policy repeats this pause on every retry."""
+ usage, pause_interval = self._parse_call_rate_header(exc.http_headers())
+ self._pause_if_usage_high(usage, min(pause_interval, self.MAX_PAUSE_INTERVAL))
def _update_insights_throttle_limit(self, response: FacebookResponse):
"""
@@ -168,10 +224,27 @@ def call(
"""Makes an API call, delegate actual work to parent class and handles call rates"""
if self._should_restore_default_page_size(params):
params.update(**{"limit": self.default_page_size})
- response = super().call(method, path, params, headers, files, url_override, api_version)
- self._update_insights_throttle_limit(response)
- self._handle_call_rate_limit(response, params)
- return response
+ while True:
+ try:
+ response = super().call(method, path, params, headers, files, url_override, api_version)
+ except FacebookRequestError as exc:
+ if not self.pause_on_rate_limit:
+ raise
+ if self._is_quota_block_error(exc):
+ # Handled and retried here, without raising, so the wait isn't counted against
+ # @backoff_policy's max_tries -- a quota block can outlast that budget. Once the
+ # MAX_QUOTA_BLOCK_WAIT budget is spent, re-raise without pausing again so the
+ # ladder gives up in seconds instead of re-entering with a fresh budget.
+ if self._quota_block_wait_elapsed < self.MAX_QUOTA_BLOCK_WAIT:
+ self._quota_block_wait_elapsed += self._handle_quota_block_error(exc)
+ continue
+ elif exc.api_error_code() in FACEBOOK_RATE_LIMIT_ERROR_CODES:
+ self._handle_failed_call_rate_limit(exc)
+ raise
+ self._quota_block_wait_elapsed = timedelta()
+ self._update_insights_throttle_limit(response)
+ self._handle_call_rate_limit(response, params)
+ return response
class API:
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/config_migrations.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/config_migrations.py
index 54d19b968dfb..c5d9eb0c52e1 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/config_migrations.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/config_migrations.py
@@ -158,7 +158,11 @@ def _transform(cls, config: Mapping[str, Any]) -> Mapping[str, Any]:
config["credentials"] = {
"auth_type": "Service",
}
- if "access_token" in config:
+ # Only migrate top-level access_token when credentials.access_token is not already set.
+ # Chrome autofill can inject saved passwords into the legacy top-level access_token field,
+ # and unconditionally copying it here would overwrite a valid OAuth token stored in credentials.
+ # See: https://github.com/airbytehq/oncall/issues/12978
+ if "access_token" in config and "access_token" not in config.get("credentials", {}):
config["credentials"]["access_token"] = config.pop("access_token")
if "client_id" in config:
config["credentials"]["auth_type"] = "Client"
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/ads_insights_breakdowns.json b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/ads_insights_breakdowns.json
index b1db6ba87d71..80612f65d5a6 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/ads_insights_breakdowns.json
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/ads_insights_breakdowns.json
@@ -112,10 +112,6 @@
"description": "The device platform (e.g., mobile, desktop) targeted by the ad.",
"type": ["null", "string"]
},
- "dma": {
- "description": "Designated Market Area for ad targeting in the United States.",
- "type": ["null", "string"]
- },
"fidelity_type": {
"type": ["null", "string"],
"description": "The fidelity type of the ad."
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/shared/ads_action_stats.json b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/shared/ads_action_stats.json
index f2706fbc91dd..37169abc9530 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/shared/ads_action_stats.json
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/schemas/shared/ads_action_stats.json
@@ -15,6 +15,9 @@
"1d_view": {
"type": ["null", "number"]
},
+ "1d_ev": {
+ "type": ["null", "number"]
+ },
"incrementality": {
"type": ["null", "number"]
},
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/source.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/source.py
index bfeac77feb3c..02c68826c16e 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/source.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/source.py
@@ -38,15 +38,15 @@
AdsInsightsActionVideoSound,
AdsInsightsActionVideoType,
AdsInsightsAgeAndGender,
+ AdsInsightsComscoreMarket,
AdsInsightsCountry,
AdsInsightsDeliveryDevice,
AdsInsightsDeliveryPlatform,
AdsInsightsDeliveryPlatformAndDevicePlatform,
AdsInsightsDemographicsAge,
+ AdsInsightsDemographicsComscoreMarketRegion,
AdsInsightsDemographicsCountry,
- AdsInsightsDemographicsDMARegion,
AdsInsightsDemographicsGender,
- AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
Campaigns,
@@ -113,6 +113,8 @@ def check_connection(self, logger: logging.Logger, config: Mapping[str, Any]) ->
)
else:
api = API(access_token=config.access_token, page_size=config.page_size)
+ # fail fast on rate limits: the platform fails a check that has not finished within 9 minutes
+ api.api.pause_on_rate_limit = False
for account_id in config.account_ids:
# Get Ad Account to check creds
@@ -163,6 +165,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Type[Stream]]:
insights_job_timeout=config.insights_job_timeout,
filter_statuses=[status.value for status in [*ValidAdStatuses]],
include_incrementality=config.include_incrementality,
+ include_engaged_view=config.include_engaged_view,
)
streams = [
AdAccount(api=api, account_ids=config.account_ids),
@@ -192,6 +195,8 @@ def streams(self, config: Mapping[str, Any]) -> List[Type[Stream]]:
api=api,
account_ids=config.account_ids,
fetch_thumbnail_images=config.fetch_thumbnail_images,
+ start_date=config.start_date,
+ end_date=config.end_date,
filter_statuses=config.ad_statuses,
page_size=config.page_size,
),
@@ -205,7 +210,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Type[Stream]]:
AdsInsightsAgeAndGender(page_size=config.page_size, **insights_args),
AdsInsightsCountry(page_size=config.page_size, **insights_args),
AdsInsightsRegion(page_size=config.page_size, **insights_args),
- AdsInsightsDma(page_size=config.page_size, **insights_args),
+ AdsInsightsComscoreMarket(page_size=config.page_size, **insights_args),
AdsInsightsPlatformAndDevice(page_size=config.page_size, **insights_args),
AdsInsightsActionType(page_size=config.page_size, **insights_args),
AdsInsightsActionCarouselCard(page_size=config.page_size, **insights_args),
@@ -219,7 +224,7 @@ def streams(self, config: Mapping[str, Any]) -> List[Type[Stream]]:
AdsInsightsDeliveryPlatformAndDevicePlatform(page_size=config.page_size, **insights_args),
AdsInsightsDemographicsAge(page_size=config.page_size, **insights_args),
AdsInsightsDemographicsCountry(page_size=config.page_size, **insights_args),
- AdsInsightsDemographicsDMARegion(page_size=config.page_size, **insights_args),
+ AdsInsightsDemographicsComscoreMarketRegion(page_size=config.page_size, **insights_args),
AdsInsightsDemographicsGender(page_size=config.page_size, **insights_args),
Campaigns(
api=api,
@@ -342,9 +347,9 @@ def get_custom_insights_streams(self, api: API, config: ConnectorConfig) -> List
api=api,
account_ids=config.account_ids,
name=f"Custom{insight.name}",
- fields=list(insight_fields),
- breakdowns=list(set(insight.breakdowns)),
- action_breakdowns=list(set(insight.action_breakdowns)),
+ fields=list(dict.fromkeys(insight.fields)),
+ breakdowns=list(dict.fromkeys(insight.breakdowns)),
+ action_breakdowns=list(dict.fromkeys(insight.action_breakdowns)),
action_breakdowns_allow_empty=config.action_breakdowns_allow_empty,
time_increment=insight.time_increment,
time_increment_period=insight.time_increment_period,
@@ -354,6 +359,7 @@ def get_custom_insights_streams(self, api: API, config: ConnectorConfig) -> List
insights_job_timeout=insight.insights_job_timeout or config.insights_job_timeout,
level=insight.level,
include_incrementality=insight.include_incrementality,
+ include_engaged_view=insight.include_engaged_view,
)
streams.append(stream)
return streams
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/spec.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/spec.py
index 29f6ed7a4d0f..6a358284e131 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/spec.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/spec.py
@@ -30,6 +30,11 @@
# Add the missing one: https://github.com/airbytehq/oncall/issues/9525
base_breakdowns["user_segment_key"] = "user_segment_key"
+
+# Meta deprecated breakdowns=dma on June 22, 2026, replacing it with comscore_market.
+# Remove dma so it can't be selected for Custom Insights; configs still using it are rejected
+# by the CDK's config-vs-spec validation with a config_error that lists comscore_market.
+base_breakdowns.pop("dma", None)
ValidBreakdowns = Enum("ValidBreakdowns", base_breakdowns)
ValidActionBreakdowns = Enum("ValidActionBreakdowns", AdsInsights.ActionBreakdowns.__dict__)
ValidCampaignStatuses = Enum("ValidCampaignStatuses", Campaign.EffectiveStatus.__dict__)
@@ -72,8 +77,9 @@ class Config(OneOfOptionConfig):
access_token: Optional[str] = Field(
title="Access Token",
description="The value of the generated access token. "
- 'From your App’s Dashboard, click on "Marketing API" then "Tools". '
- 'Select permissions ads_management, ads_read, read_insights, business_management. Then click on "Get token". '
+ "We recommend a Meta system user access token: in Meta Business Settings, go to Users > System users, "
+ "assign your ad account(s) to the system user, then click Generate new token for your app and select the "
+ "ads_read, ads_management, and business_management permissions. "
'See the docs for more information.',
airbyte_secret=True,
)
@@ -88,8 +94,9 @@ class Config(OneOfOptionConfig):
access_token: str = Field(
title="Access Token",
description="The value of the generated access token. "
- 'From your App’s Dashboard, click on "Marketing API" then "Tools". '
- 'Select permissions ads_management, ads_read, read_insights, business_management. Then click on "Get token". '
+ "We recommend a Meta system user access token: in Meta Business Settings, go to Users > System users, "
+ "assign your ad account(s) to the system user, then click Generate new token for your app and select the "
+ "ads_read, ads_management, and business_management permissions. "
'See the docs for more information.',
airbyte_secret=True,
)
@@ -218,6 +225,15 @@ def validate_time_increment_mutual_exclusion(cls, time_increment_period, values)
default=False,
)
+ include_engaged_view: bool = Field(
+ title="Include Engaged View",
+ description=(
+ "If enabled, the engaged view (ev) attribution window will be included in the action attribution windows for this custom insight. "
+ "This allows you to retrieve attribution data for users who had an engaged view of a video ad (watched 10+ seconds or 97%+ of a short video)."
+ ),
+ default=False,
+ )
+
class ConnectorConfig(BaseConfig):
"""Connector config"""
@@ -245,11 +261,13 @@ class Config:
order=1,
description=(
"The value of the generated access token. "
- 'From your App’s Dashboard, click on "Marketing API" then "Tools". '
- 'Select permissions ads_management, ads_read, read_insights, business_management. Then click on "Get token". '
+ "We recommend a Meta system user access token: in Meta Business Settings, go to Users > System users, "
+ "assign your ad account(s) to the system user, then click Generate new token for your app and select the "
+ "ads_read, ads_management, and business_management permissions. "
'See the docs for more information.'
),
airbyte_secret=True,
+ airbyte_hidden=True,
)
credentials: Union[OAuthCredentials, ServiceAccountCredentials] = Field(
@@ -263,7 +281,7 @@ class Config:
order=2,
description=(
"The date from which you'd like to replicate data for all incremental streams, "
- "in the format YYYY-MM-DDT00:00:00Z. If not set then all data will be replicated for usual streams and only last 2 years for insight streams."
+ "in the format YYYY-MM-DDT00:00:00Z. If not set then all data will be replicated for usual streams and only last 37 months for insight streams."
),
pattern=DATE_TIME_PATTERN,
examples=["2017-01-25T00:00:00Z"],
@@ -380,6 +398,18 @@ class Config:
default=False,
)
+ include_engaged_view: bool = Field(
+ title="Include Engaged View",
+ order=14,
+ description=(
+ "If enabled, the engaged view (ev) attribution window will be included in the action attribution windows for all built-in insight streams. "
+ "This surfaces attribution data for users who had an engaged view of a video ad (watched 10+ seconds or 97%+ of a short video). "
+ "See the Facebook Marketing API documentation for more details: "
+ "https://developers.facebook.com/docs/marketing-api/reference/ads-action-stats/"
+ ),
+ default=False,
+ )
+
action_breakdowns_allow_empty: bool = Field(
description="Allows action_breakdowns to be an empty list",
default=True,
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/__init__.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/__init__.py
index 09e7d1eac179..fdd9d0ce9d3c 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/__init__.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/__init__.py
@@ -18,15 +18,15 @@
AdsInsightsActionVideoSound,
AdsInsightsActionVideoType,
AdsInsightsAgeAndGender,
+ AdsInsightsComscoreMarket,
AdsInsightsCountry,
AdsInsightsDeliveryDevice,
AdsInsightsDeliveryPlatform,
AdsInsightsDeliveryPlatformAndDevicePlatform,
AdsInsightsDemographicsAge,
+ AdsInsightsDemographicsComscoreMarketRegion,
AdsInsightsDemographicsCountry,
- AdsInsightsDemographicsDMARegion,
AdsInsightsDemographicsGender,
- AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
Campaigns,
@@ -46,7 +46,7 @@
"AdsInsightsActionType",
"AdsInsightsAgeAndGender",
"AdsInsightsCountry",
- "AdsInsightsDma",
+ "AdsInsightsComscoreMarket",
"AdsInsightsPlatformAndDevice",
"AdsInsightsRegion",
"AdsInsightsActionCarouselCard",
@@ -60,7 +60,7 @@
"AdsInsightsDeliveryPlatformAndDevicePlatform",
"AdsInsightsDemographicsAge",
"AdsInsightsDemographicsCountry",
- "AdsInsightsDemographicsDMARegion",
+ "AdsInsightsDemographicsComscoreMarketRegion",
"AdsInsightsDemographicsGender",
"Campaigns",
"CustomConversions",
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job.py
index 4a780128b7c3..7e2d2ac7486a 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job.py
@@ -31,6 +31,12 @@
logger = logging.getLogger("airbyte")
+# Special "incrementality" attribution window (Meta beta). Facebook does not compute incrementality
+# for geographic breakdowns such as `comscore_market`/`region`, and an async report combining it with certain
+# fields (e.g. `conversions`) under those breakdowns cannot be generated at all (oncall #12088).
+# Mirrors `AdsInsights.INCREMENTALITY_WINDOW` in base_insight_streams.py.
+INCREMENTALITY_WINDOW = "incrementality"
+
# `FacebookBadObjectError` occurs in FB SDK when it fetches an inconsistent or corrupted data.
# It still has http status 200 but the object can not be constructed from what was fetched from API.
# Also, it does not happen while making a call to the API, but later - when parsing the result,
@@ -40,6 +46,29 @@
# ----------------------------- batching -------------------------------------
+# Facebook caps batch requests at 50 entries; sending more returns a
+# GraphBatchException ("An error has occurred. No further information is
+# available."), which fails the whole sync.
+_FB_MAX_BATCH_SIZE = 50
+
+
+def _pending_leaves(jobs: List["AsyncJob"]) -> Iterator["AsyncJob"]:
+ """Yield jobs that contribute one batch entry to a status-poll call.
+
+ A ParentAsyncJob does not poll itself — it just delegates to its
+ children — so we recurse into its `_jobs` list. This lets
+ `update_in_batch` enforce the per-batch size cap across nested parents
+ instead of only between top-level entries in the input list.
+ """
+ for job in jobs:
+ if not job.started or job.completed:
+ continue
+ if isinstance(job, ParentAsyncJob):
+ yield from _pending_leaves(job._jobs)
+ else:
+ yield job
+
+
def update_in_batch(api: FacebookAdsApi, jobs: List["AsyncJob"]):
"""Update status of each job in the list in a batch, making it most efficient way to update status.
@@ -47,24 +76,27 @@ def update_in_batch(api: FacebookAdsApi, jobs: List["AsyncJob"]):
:param jobs:
"""
batch = api.new_batch()
- max_batch_size = 50
- for job in jobs:
- if not job.started or job.completed:
- continue
- # we check it here because job can be already finished
- if len(batch) == max_batch_size:
+ for leaf in _pending_leaves(jobs):
+ leaf.update_job(batch=batch)
+ if len(batch) >= _FB_MAX_BATCH_SIZE:
while batch:
# If some of the calls from batch have failed, it returns a new
# FacebookAdsApiBatch object with those calls
batch = batch.execute()
batch = api.new_batch()
- job.update_job(batch=batch)
while batch:
# If some of the calls from batch have failed, it returns a new
# FacebookAdsApiBatch object with those calls
batch = batch.execute()
+ # Polling is done — let each parent consolidate any child-produced
+ # replacement work (mirrors what ParentAsyncJob.update_job used to do
+ # right after its child loop).
+ for job in jobs:
+ if isinstance(job, ParentAsyncJob):
+ job._splice_new_children()
+
# ------------------------------ status --------------------------------------
class Status(str, Enum):
@@ -191,11 +223,22 @@ def failed(self) -> bool:
return all(child.completed for child in self._jobs) and any(child.failed for child in self._jobs)
def update_job(self, batch: Optional[FacebookAdsApiBatch] = None):
+ # Direct call (outside update_in_batch): keep the original semantics
+ # of polling children inline and then splicing. Inside
+ # update_in_batch, leaves are polled via _pending_leaves() and
+ # _splice_new_children() is invoked separately so the 50-per-batch
+ # cap is respected when a parent has many children.
for child in self._jobs:
if child.started and not child.completed:
child.update_job(batch=batch)
+ self._splice_new_children()
- # If any child produced replacement work, splice it in-place.
+ def _splice_new_children(self) -> None:
+ """Replace children that produced `new_jobs` with the new work,
+ recursing so nested parents are spliced bottom-up."""
+ for child in self._jobs:
+ if isinstance(child, ParentAsyncJob):
+ child._splice_new_children()
new_children: List[AsyncJob] = []
for job in self._jobs:
if job.new_jobs:
@@ -261,6 +304,7 @@ def __init__(
job_timeout: timedelta,
primary_key: Optional[List[str]] = None,
object_breakdowns: Optional[Mapping[str, str]] = None,
+ stream_name: Optional[str] = None,
**kwargs,
):
super().__init__(**kwargs)
@@ -275,6 +319,7 @@ def __init__(
self._job: Optional[AdReportRun] = None
self._primary_key = primary_key or []
self._object_breakdowns = dict(object_breakdowns or {})
+ self._stream_name = stream_name
self._start_time = None
self._finish_time = None
self._failed = False
@@ -428,6 +473,7 @@ def _split_by_edge_class(self, edge_class: Union[Type[Campaign], Type[AdSet], Ty
job_timeout=self._job_timeout,
primary_key=self._primary_key,
object_breakdowns=self._object_breakdowns,
+ stream_name=self._stream_name,
)
for pk in ids
]
@@ -466,7 +512,16 @@ def _collect_child_ids(self, pk_name: str, level: str) -> List[str]:
start_ts = ab_datetime_now()
while True:
- id_job = id_job.api_get()
+ try:
+ id_job = id_job.api_get()
+ except FacebookRequestError as e:
+ raise traced_exception(e) from e
+ except (FacebookBadObjectError, TypeError) as e:
+ raise AirbyteTracedException(
+ message="Facebook Insights API returned an invalid response.",
+ internal_message=f"Failed to poll ID-collection job at level={level}: {e}",
+ failure_type=FailureType.transient_error,
+ ) from e
status = id_job.get("async_status")
percent = id_job.get("async_percent_completion")
logger.info(f"[Split:{level}] attempt={attempt}, status={status}, {percent}%")
@@ -514,21 +569,47 @@ def _collect_child_ids(self, pk_name: str, level: str) -> List[str]:
def _split_by_fields_parent(self) -> ParentAsyncJob:
all_fields: List[str] = list(self._params.get("fields", []))
- split_candidates = [f for f in all_fields if f not in self._primary_key]
+ primary_key_fields = [field for field in self._primary_key if field in all_fields]
+ split_candidates = [f for f in all_fields if f not in primary_key_fields]
if len(split_candidates) <= 1:
+ # Terminal, unsplittable leaf: Facebook keeps failing to generate this report even for a
+ # single field at single-ad/single-day granularity, so there is nothing left to split.
+ # This is a deterministic Facebook-side limitation, not a connector bug, and the user has a
+ # concrete fix (unselect the offending field; or, when the `incrementality` window is in
+ # play, disable "Include Incrementality"). Surface it as a config_error with actionable
+ # guidance instead of a cryptic system_error (oncall #12088).
+ breakdowns = self._params.get("breakdowns", [])
+ has_incrementality = INCREMENTALITY_WINDOW in self._params.get("action_attribution_windows", [])
+
+ stream_part = f" for stream '{self._stream_name}'" if self._stream_name else ""
+ scope = f"breakdown(s) {breakdowns} with the field(s) {split_candidates}" if breakdowns else f"the field(s) {split_candidates}"
+ fixes = []
+ if has_incrementality:
+ fixes.append('disable the "Include Incrementality" option for this stream')
+ fixes.append(f"unselect the field(s) {split_candidates} from this stream's schema")
+ fix_text = "; or ".join(f"({i + 1}) {fix}" for i, fix in enumerate(fixes)) if len(fixes) > 1 else fixes[0]
+
raise AirbyteTracedException(
- message="Unable to split the Facebook Insights request because there are not enough non-primary-key fields.",
- internal_message=f"Cannot split by fields: not enough non-PK fields (candidates={split_candidates}, pk={self._primary_key})",
- failure_type=FailureType.system_error,
+ message=(
+ f"Facebook could not generate the Insights report{stream_part} for {scope}"
+ + (' when the "incrementality" attribution window is enabled' if has_incrementality else "")
+ + f", even at the smallest request size. This is a Facebook-side limitation. To resolve it, {fix_text}."
+ ),
+ internal_message=(
+ f"Cannot split by fields: not enough non-PK fields (candidates={split_candidates}, "
+ f"pk={self._primary_key}); stream={self._stream_name}, breakdowns={breakdowns}, "
+ f"level={self._params.get('level')}, incrementality={has_incrementality}"
+ ),
+ failure_type=FailureType.config_error,
)
mid = len(split_candidates) // 2
part_a, part_b = split_candidates[:mid], split_candidates[mid:]
params_a = dict(self._params)
- params_a["fields"] = self._primary_key + part_a
+ params_a["fields"] = primary_key_fields + part_a
params_b = dict(self._params)
- params_b["fields"] = self._primary_key + part_b
+ params_b["fields"] = primary_key_fields + part_b
job_a = InsightAsyncJob(
api=self._api,
@@ -538,6 +619,7 @@ def _split_by_fields_parent(self) -> ParentAsyncJob:
job_timeout=self._job_timeout,
primary_key=self._primary_key,
object_breakdowns=self._object_breakdowns,
+ stream_name=self._stream_name,
)
job_b = InsightAsyncJob(
api=self._api,
@@ -547,6 +629,7 @@ def _split_by_fields_parent(self) -> ParentAsyncJob:
job_timeout=self._job_timeout,
primary_key=self._primary_key,
object_breakdowns=self._object_breakdowns,
+ stream_name=self._stream_name,
)
logger.info("%s split by fields: common=%d, A=%d, B=%d", self, len(self._primary_key), len(part_a), len(part_b))
return ParentAsyncJob(
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job_manager.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job_manager.py
index 08960e3dd4d8..fa906ee397f8 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job_manager.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/async_job_manager.py
@@ -4,6 +4,8 @@
import time
from typing import TYPE_CHECKING, Iterator, List, Optional
+from facebook_business.exceptions import FacebookBadObjectError
+
from .async_job import AsyncJob, update_in_batch # ParentAsyncJob not needed here
@@ -34,8 +36,21 @@ def refresh_throttle(self) -> None:
"""
Ping the account to refresh the `x-fb-ads-insights-throttle` header and cache the value.
NOTE: This is inexpensive (empty insights call) and safe to perform before scheduling.
+
+ Facebook occasionally returns a malformed response that the SDK cannot parse,
+ raising `FacebookBadObjectError`. The ping is best-effort and only updates a
+ cached throttle estimate, so we log the failure and keep the previous value
+ instead of failing the entire sync.
"""
- self._api.get_account(account_id=self._account_id).get_insights()
+ try:
+ self._api.get_account(account_id=self._account_id).get_insights()
+ except FacebookBadObjectError as exc:
+ logger.warning(
+ "Facebook returned a malformed response while refreshing the insights throttle; keeping the previous estimate of %.1f. Error: %s",
+ self._current_throttle,
+ exc,
+ )
+ return
t = self._api.api.ads_insights_throttle
# Use the stricter of the two numbers.
self._current_throttle = max(getattr(t, "per_account", 0.0), getattr(t, "per_application", 0.0))
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_insight_streams.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_insight_streams.py
index e422f45263cb..b299fcc61f7e 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_insight_streams.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/base_insight_streams.py
@@ -43,6 +43,10 @@ class AdsInsights(FBMarketingIncrementalStream):
INCREMENTALITY_WINDOW = "incrementality"
+ EV_ACTION_ATTRIBUTION_WINDOWS = [
+ "1d_ev",
+ ]
+
breakdowns = []
action_breakdowns = [
"action_type",
@@ -84,6 +88,7 @@ def __init__(
insights_job_timeout: int = 60,
level: str = "ad",
include_incrementality: bool = False,
+ include_engaged_view: bool = False,
**kwargs,
):
super().__init__(**kwargs)
@@ -117,8 +122,12 @@ def __init__(
self.level = level
self.entity_prefix = level
+ windows = list(self.ALL_ACTION_ATTRIBUTION_WINDOWS)
if include_incrementality:
- self.action_attribution_windows = list(self.ALL_ACTION_ATTRIBUTION_WINDOWS) + [self.INCREMENTALITY_WINDOW]
+ windows.append(self.INCREMENTALITY_WINDOW)
+ if include_engaged_view:
+ windows.extend(self.EV_ACTION_ATTRIBUTION_WINDOWS)
+ self.action_attribution_windows = windows
# state
self._cursor_values: Optional[Mapping[str, date]] = None # latest period that was read for each account
@@ -188,6 +197,20 @@ def _transform_breakdown(self, record: Mapping[str, Any]) -> Mapping[str, Any]:
record[self.object_breakdowns[breakdown]] = record[breakdown]["id"]
return record
+ @cached_property
+ def _should_rename_results(self) -> bool:
+ """Stream-level part of the 'results' -> 'objective_results' rename decision, computed once instead of per record."""
+ if not self._custom_fields:
+ return False
+
+ properties = self.get_json_schema().get("properties", {})
+
+ has_objective_results_in_schema = "objective_results" in properties
+ has_objective_results_in_fields = "objective_results" in self._custom_fields
+ has_results_in_fields = "results" in self._custom_fields
+
+ return has_objective_results_in_schema and has_objective_results_in_fields and not has_results_in_fields
+
def _transform_objective_results(self, record: Mapping[str, Any]) -> Mapping[str, Any]:
"""
Transform 'results' field to 'objective_results' in API responses.
@@ -201,19 +224,7 @@ def _transform_objective_results(self, record: Mapping[str, Any]) -> Mapping[str
See: https://github.com/airbytehq/oncall/issues/10126
"""
- if not self._custom_fields:
- return record
-
- schema = self.get_json_schema()
- properties = schema.get("properties", {})
-
- has_objective_results_in_schema = "objective_results" in properties
- has_objective_results_in_fields = "objective_results" in self._custom_fields
- has_results_in_fields = "results" in self._custom_fields
-
- should_rename = has_objective_results_in_schema and has_objective_results_in_fields and not has_results_in_fields
-
- if should_rename and "results" in record and "objective_results" not in record:
+ if self._should_rename_results and "results" in record and "objective_results" not in record:
record["objective_results"] = record.pop("results")
return record
@@ -254,7 +265,7 @@ def read_records(
raise traced_exception(exc)
self._completed_slices[account_id].add(job.interval.start)
- if job.interval.start == self._next_cursor_values[account_id]:
+ if job.interval.start <= self._next_cursor_values[account_id]:
self._advance_cursor(account_id)
@property
@@ -264,10 +275,14 @@ def state(self) -> MutableMapping[str, Any]:
if self._cursor_values:
for account_id in self._account_ids:
- if account_id in self._cursor_values and self._cursor_values[account_id]:
- new_state[account_id] = {self.cursor_field: self._cursor_values[account_id].isoformat()}
-
- new_state[account_id]["slices"] = sorted(list({d.isoformat() for d in self._completed_slices[account_id]}))
+ cursor_value = self._cursor_values.get(account_id)
+ if cursor_value:
+ new_state[account_id] = {self.cursor_field: cursor_value.isoformat()}
+
+ completed_slices = self._completed_slices[account_id]
+ if cursor_value:
+ completed_slices = {d for d in completed_slices if d > cursor_value}
+ new_state[account_id]["slices"] = sorted(list({d.isoformat() for d in completed_slices}))
new_state["time_increment"] = self.time_increment
if self.time_increment_period is not None:
new_state["time_increment_period"] = self.time_increment_period.value
@@ -275,7 +290,11 @@ def state(self) -> MutableMapping[str, Any]:
if self._completed_slices:
for account_id in self._account_ids:
- new_state[account_id]["slices"] = sorted(list({d.isoformat() for d in self._completed_slices[account_id]}))
+ cursor_value = (self._cursor_values or {}).get(account_id)
+ completed_slices = self._completed_slices[account_id]
+ if cursor_value:
+ completed_slices = {d for d in completed_slices if d > cursor_value}
+ new_state[account_id]["slices"] = sorted(list({d.isoformat() for d in completed_slices}))
new_state["time_increment"] = self.time_increment
if self.time_increment_period is not None:
@@ -309,10 +328,13 @@ def state(self, value: Mapping[str, Any]):
)
for account_id in self._account_ids
}
- self._completed_slices = {
- account_id: set(ab_datetime_parse(v).date() for v in transformed_state.get(account_id, {}).get("slices", []))
- for account_id in self._account_ids
- }
+ self._completed_slices = {}
+ for account_id in self._account_ids:
+ cursor_value = self._cursor_values.get(account_id)
+ completed_slices = {ab_datetime_parse(value).date() for value in transformed_state.get(account_id, {}).get("slices", [])}
+ self._completed_slices[account_id] = {
+ slice_date for slice_date in completed_slices if cursor_value is None or slice_date > cursor_value
+ }
self._next_cursor_values = self._get_start_date()
@@ -402,16 +424,17 @@ def _date_intervals(self, account_id: str) -> Iterator[date]:
current_date += timedelta(days=self.time_increment)
def _advance_cursor(self, account_id: str):
- """Iterate over state, find continuing sequence of slices. Get last value, advance cursor there and remove slices from state"""
+ """Walk completed contiguous slices and advance the cursor without regressing it."""
for ts_start in self._date_intervals(account_id):
if ts_start not in self._completed_slices[account_id]:
self._next_cursor_values[account_id] = ts_start
break
self._completed_slices[account_id].remove(ts_start)
- if self._cursor_values:
- self._cursor_values[account_id] = ts_start
- else:
- self._cursor_values = {account_id: ts_start}
+ cursor_value = (self._cursor_values or {}).get(account_id)
+ self._cursor_values = {
+ **(self._cursor_values or {}),
+ account_id: max(cursor_value, ts_start) if cursor_value is not None else ts_start,
+ }
def _generate_async_jobs(self, params: Mapping, account_id: str) -> Iterator[AsyncJob]:
"""Generator of async jobs
@@ -437,6 +460,7 @@ def _generate_async_jobs(self, params: Mapping, account_id: str) -> Iterator[Asy
job_timeout=self.insights_job_timeout,
primary_key=self.primary_key,
object_breakdowns=self.object_breakdowns,
+ stream_name=self.name,
)
def check_breakdowns(self, account_id: str):
@@ -623,6 +647,12 @@ def get_json_schema(self) -> Mapping[str, Any]:
"""Add fields from breakdowns to the stream schema
:return: A dict of the JSON schema representing this stream.
"""
+ return self._json_schema
+
+ @cached_property
+ def _json_schema(self) -> Mapping[str, Any]:
+ # get_json_schema() is called for every record, so load and resolve the schema files only once.
+ # The result depends only on settings fixed in __init__ (custom fields, breakdowns, level).
loader = ResourceSchemaLoader(package_name_from_class(self.__class__))
schema = loader.get_schema("ads_insights")
if self._custom_fields:
@@ -661,7 +691,8 @@ def fields(self, **kwargs) -> List[str]:
List of fields that we want to query, if no json_schema from configured catalog then will get all properties from stream's schema
"""
if self._custom_fields:
- return self._custom_fields
+ excluded_fields = self._fields_excluded_from_api_request()
+ return [field for field in self._custom_fields if field not in excluded_fields]
if self._fields:
return self._fields
@@ -672,16 +703,12 @@ def fields(self, **kwargs) -> List[str]:
)
self._fields = list(schema.get("properties", {}).keys())
- # Check that no breakdowns are injected from configured catalog schema (review "get_json_schema" doc).
- removable_keys = list(self.breakdowns if self.breakdowns else [])
- # Having this field in syncs seem to have caused data inaccuracy where fields like `spend` had the wrong values
- removable_keys.append("wish_bid")
- # Meta rejects the whole insights request with error #100 when this field is requested
- removable_keys.append("qualifying_question_qualify_answer_rate")
- for removable_key in removable_keys:
- try:
- self._fields.remove(removable_key)
- except ValueError:
- pass
+ excluded_fields = self._fields_excluded_from_api_request()
+ self._fields = [field for field in self._fields if field not in excluded_fields]
return self._fields
+
+ def _fields_excluded_from_api_request(self) -> set[str]:
+ object_breakdown_ids = {self.object_breakdowns[breakdown] for breakdown in self.breakdowns if breakdown in self.object_breakdowns}
+ # Meta rejects the whole insights request with error #100 when qualifying_question_qualify_answer_rate is requested
+ return set(self.breakdowns) | object_breakdown_ids | {"wish_bid", "qualifying_question_qualify_answer_rate"}
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/common.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/common.py
index e5d91843e2ad..ac1e59bd5aad 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/common.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/common.py
@@ -10,6 +10,7 @@
from typing import Any
import backoff
+import requests
from facebook_business.exceptions import FacebookRequestError
from airbyte_cdk.models import FailureType
@@ -37,6 +38,14 @@
FACEBOOK_UNKNOWN_ERROR_CODE = 99
FACEBOOK_CONNECTION_RESET_ERROR_CODE = 104
DEFAULT_SLEEP_INTERVAL = timedelta(minutes=1)
+# Transport-level failures raised by `requests` inside the facebook_business SDK session
+# (dropped keep-alive connections, truncated chunked responses, read timeouts). The SDK bypasses
+# the CDK HttpClient, so these mirror the CDK's own transient exceptions.
+TRANSIENT_NETWORK_EXCEPTIONS = (
+ requests.exceptions.ConnectionError,
+ requests.exceptions.ChunkedEncodingError,
+ requests.exceptions.ReadTimeout,
+)
logger = logging.getLogger("airbyte")
@@ -57,6 +66,10 @@ def log_retry_attempt(details):
def reduce_request_record_limit(details):
_, exc, _ = sys.exc_info()
+ # Only attempt limit reduction for FacebookRequestError, not for
+ # network-level exceptions like ConnectionError which lack http_status().
+ if not isinstance(exc, FacebookRequestError):
+ return
# the list of error patterns to track,
# in order to reduce the request page size and retry
error_patterns = [
@@ -88,8 +101,16 @@ def revert_request_record_limit(details):
details.get("args")[0].request_record_limit_is_reduced = False
def give_up(details):
- if isinstance(details["exception"], FacebookRequestError):
- raise traced_exception(details["exception"])
+ exc = details["exception"]
+ if isinstance(exc, FacebookRequestError):
+ raise traced_exception(exc)
+ if isinstance(exc, TRANSIENT_NETWORK_EXCEPTIONS):
+ raise AirbyteTracedException(
+ message="Network connection to the Facebook Marketing API was interrupted.",
+ internal_message=f"{type(exc).__name__} persisted after {details['tries']} attempts: {exc}",
+ failure_type=FailureType.transient_error,
+ exception=exc,
+ )
def is_transient_cannot_include_error(exc: FacebookRequestError) -> bool:
"""After migration to API v19.0, some customers randomly face a BAD_REQUEST error (OAuthException) with the pattern:"Cannot include ..."
@@ -165,7 +186,9 @@ def traced_exception(fb_exception: FacebookRequestError):
failure_type = FailureType.config_error
friendly_msg = (
"The access token for this connection is invalid or corrupted. "
- "Please re-authenticate your Facebook connection in Airbyte. "
+ "This may be caused by browser autofill overwriting the OAuth token with saved credentials. "
+ "Please re-authenticate your Facebook connection by clicking 'Authenticate your account' and saving the configuration. "
+ "See https://docs.airbyte.com/integrations/sources/facebook-marketing#connection-check-fails-with-invalid-access-token-after-re-authenticating for details. "
"If re-authentication does not resolve the issue, go to facebook.com > Settings > Business Integrations, "
"remove the Airbyte app, and then re-authenticate again."
)
@@ -229,6 +252,11 @@ def traced_exception(fb_exception: FacebookRequestError):
failure_type = FailureType.system_error
error_code = fb_exception.api_error_code() if fb_exception.api_error_code() else fb_exception.http_status()
friendly_msg = f"Error code {error_code}: {msg}."
+ user_facing_details = _get_user_facing_error_details(fb_exception)
+ if user_facing_details:
+ error_subcode = fb_exception.api_error_subcode()
+ subcode_part = f" (subcode {error_subcode})" if error_subcode else ""
+ friendly_msg = f"Error code {error_code}{subcode_part}: {msg}. Facebook details: {user_facing_details}"
return AirbyteTracedException(
message=friendly_msg or msg,
@@ -236,3 +264,16 @@ def traced_exception(fb_exception: FacebookRequestError):
failure_type=failure_type,
exception=fb_exception,
)
+
+
+def _get_user_facing_error_details(fb_exception: FacebookRequestError) -> str:
+ """Return Meta's localized `error_user_title` / `error_user_msg` text, if the Graph API error includes it."""
+ error = fb_exception._error if isinstance(fb_exception._error, dict) else {}
+ parts = []
+ for key in ("error_user_title", "error_user_msg"):
+ value = error.get(key)
+ if isinstance(value, str) and value.strip():
+ text = value.strip().rstrip(".")
+ if text not in parts:
+ parts.append(text)
+ return f"{'. '.join(parts)}." if parts else ""
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/patches.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/patches.py
index 53922703750c..86ea003dffb4 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/patches.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/patches.py
@@ -2,10 +2,17 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
+import logging
from urllib.parse import parse_qsl, urlparse, urlunparse
from facebook_business.api import Cursor
+from airbyte_cdk.models import FailureType
+from airbyte_cdk.utils import AirbyteTracedException
+
+
+logger = logging.getLogger("airbyte")
+
class CursorPatch(Cursor):
"""
@@ -45,22 +52,42 @@ def load_next_page(self):
response = response_obj.json()
self._headers = response_obj.headers()
- if "paging" in response and "next" in response["paging"]:
- path = response["paging"]["next"]
+ if not isinstance(response, dict):
+ raise AirbyteTracedException(
+ message="Facebook Marketing API response is not a JSON object.",
+ internal_message=f"Expected dict from response_obj.json(), got {type(response).__name__}: {repr(response)[:200]}",
+ failure_type=FailureType.transient_error,
+ )
+
+ paging = response.get("paging")
+ if isinstance(paging, dict) and "next" in paging:
+ path = paging["next"]
# Here comes the magic.
# self._path used to be path, self.params used to be {}
# Now we separate params from the rest.
self._path = urlunparse(urlparse(path)._replace(query={}))
self.params = dict(parse_qsl(urlparse(path).query))
else:
- # Indicate if this was the last page
+ if paging is not None and not isinstance(paging, dict):
+ logger.warning(
+ "Facebook Marketing response had a non-dict 'paging' (%s); stopping pagination for this slice.",
+ type(paging).__name__,
+ )
self._finished_iteration = True
- if self._include_summary and "summary" in response and "total_count" in response["summary"]:
- self._total_count = response["summary"]["total_count"]
+ summary = response.get("summary")
+ if self._include_summary and isinstance(summary, dict) and "total_count" in summary:
+ self._total_count = summary["total_count"]
+
+ if self._include_summary and isinstance(summary, dict):
+ self._summary = summary
- if self._include_summary and "summary" in response:
- self._summary = response["summary"]
+ data = response.get("data")
+ if isinstance(data, list):
+ non_dict_count = sum(1 for item in data if not isinstance(item, dict))
+ if non_dict_count:
+ logger.warning("Filtered %d non-dict items from Facebook API response 'data' array.", non_dict_count)
+ response["data"] = [item for item in data if isinstance(item, dict)]
self._queue = self.build_objects_from_response(response)
return len(self._queue) > 0
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py
index aa3dc0fc4e4a..168e0d6c0320 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/source_facebook_marketing/streams/streams.py
@@ -4,7 +4,8 @@
import base64
import logging
-from typing import Any, Iterable, List, Mapping, Optional, Set
+from datetime import datetime, timedelta
+from typing import Any, Generator, Iterable, List, Mapping, Optional, Set, Tuple
import requests
from facebook_business.adobjects.adaccount import AdAccount as FBAdAccount
@@ -22,10 +23,50 @@
from .base_insight_streams import AdsInsights
from .base_streams import FBMarketingIncrementalStream, FBMarketingReversedIncrementalStream, FBMarketingStream
+from .patches import CursorPatch
logger = logging.getLogger("airbyte")
+# (code, error_subcode) pairs Facebook returns when reading a creative whose stored object_story_spec fails its own
+# validation, eg 2446211 "First Dof Value Should Match Object Story Spec Field". Only seen when object_story_spec is requested.
+OBJECT_STORY_SPEC_READ_ERRORS = {(100, 2446211), (100, 1443048)}
+OBJECT_STORY_SPEC_FIELD = "object_story_spec"
+
+
+def _unwrap_facebook_error(exc: Exception) -> Optional[FacebookRequestError]:
+ if isinstance(exc, FacebookRequestError):
+ return exc
+ if isinstance(exc, AirbyteTracedException) and isinstance(exc._exception, FacebookRequestError):
+ return exc._exception
+ return None
+
+
+def is_object_story_spec_read_error(exc: Exception) -> bool:
+ fb_error = _unwrap_facebook_error(exc)
+ if fb_error is None:
+ return False
+ return (fb_error.api_error_code(), fb_error.api_error_subcode()) in OBJECT_STORY_SPEC_READ_ERRORS
+
+
+def fetch_creative_with_object_story_spec_fallback(creative_id: str, fields: List[str], stream_name: str) -> Mapping[str, Any]:
+ """Fetch a single creative, re-fetching without object_story_spec when its stored value fails validation."""
+ try:
+ return FBAdCreative(creative_id).api_get(fields=fields).export_all_data()
+ except (FacebookRequestError, AirbyteTracedException) as exc:
+ fb_error = _unwrap_facebook_error(exc)
+ if fb_error is None or OBJECT_STORY_SPEC_FIELD not in fields or not is_object_story_spec_read_error(exc):
+ raise
+ error_body = fb_error.body().get("error", {}) if fb_error.body() else {}
+ reduced_fields = [f for f in fields if f != OBJECT_STORY_SPEC_FIELD]
+ creative = FBAdCreative(creative_id).api_get(fields=reduced_fields).export_all_data()
+ logger.warning(
+ f"Stream {stream_name}: creative {creative_id} failed with Facebook error "
+ f"{fb_error.api_error_code()}/{fb_error.api_error_subcode()} ({error_body.get('error_user_msg')}); "
+ f"the creative is emitted with {OBJECT_STORY_SPEC_FIELD} null."
+ )
+ return creative
+
def fetch_thumbnail_data_url(url: str) -> Optional[str]:
"""Request thumbnail image and return it embedded into the data-link"""
@@ -77,10 +118,47 @@ def read_records(
yield record
def list_objects(self, params: Mapping[str, Any], account_id: str) -> Iterable:
- return self._api.get_account(account_id=account_id).get_ad_creatives(params=params, fields=self.fields())
+ account = self._api.get_account(account_id=account_id)
+ cursor = CursorPatch(source_object=account, target_objects_class=FBAdCreative, fields=self.fields(), params=params)
+ first_page = True
+ while True:
+ try:
+ # Like get_ad_creatives(), an empty first page does not end the read: the next page is still loaded.
+ if not cursor.load_next_page() and not first_page:
+ return
+ except (FacebookRequestError, AirbyteTracedException) as exc:
+ if OBJECT_STORY_SPEC_FIELD not in self.fields() or not is_object_story_spec_read_error(exc):
+ raise
+ has_more_pages = yield from self._read_failed_page_creative_by_creative(account, cursor)
+ if not has_more_pages:
+ return
+ continue
+ first_page = False
+ for index in range(len(cursor)):
+ yield cursor[index]
+
+ def _read_failed_page_creative_by_creative(self, account: FBAdAccount, cursor: CursorPatch) -> Generator[Mapping[str, Any], None, bool]:
+ """Re-read the page that failed on object_story_spec one creative at a time, preserving pagination."""
+ # CursorPatch only replaces cursor.params (with the `next` link's query) after a successful page,
+ # so cursor.params still describes the failed page.
+ failed_page_after = cursor.params.get("after")
+ id_params = {k: v for k, v in cursor.params.items() if k != "fields"}
+ id_page = CursorPatch(source_object=account, target_objects_class=FBAdCreative, fields=["id"], params=id_params)
+ id_page.load_next_page()
+ logger.warning(
+ f"Stream {self.name}: a page of {len(id_page)} creatives for account {account.get_id_assured()} failed on "
+ f"{OBJECT_STORY_SPEC_FIELD}; re-reading it one creative at a time."
+ )
+ for index in range(len(id_page)):
+ yield fetch_creative_with_object_story_spec_fallback(id_page[index]["id"], self.fields(), self.name)
+ next_after = id_page.params.get("after")
+ if len(id_page) == 0 or next_after is None or next_after == failed_page_after:
+ return False
+ cursor.params["after"] = next_after
+ return True
-class AdCreativesFromAds(FBMarketingStream):
+class AdCreativesFromAds(FBMarketingIncrementalStream):
"""Alternative stream to fetch ad creatives through the ads endpoint.
This stream fetches creatives by first getting ads (which includes creative IDs),
@@ -100,21 +178,34 @@ class AdCreativesFromAds(FBMarketingStream):
status_field = "effective_status"
valid_statuses = [status.value for status in ValidAdStatuses]
- def __init__(self, fetch_thumbnail_images: bool = False, **kwargs):
- super().__init__(**kwargs)
+ def __init__(
+ self,
+ fetch_thumbnail_images: bool = False,
+ start_date: Optional[datetime] = None,
+ end_date: Optional[datetime] = None,
+ **kwargs,
+ ):
+ super().__init__(start_date=start_date, end_date=end_date, **kwargs)
self._fetch_thumbnail_images = fetch_thumbnail_images
self._seen_creative_ids: Set[str] = set()
self._creative_fields: Optional[List[str]] = None
- self._fields = ["id", "creative"]
+ self._fields = ["id", "creative", "updated_time"]
@property
def name(self) -> str:
return "ad_creatives_from_ads"
def get_json_schema(self) -> Mapping[str, Any]:
- """Use the same schema as ad_creatives stream"""
+ """Use the ad_creatives schema with the parent ad timestamp."""
loader = ResourceSchemaLoader(package_name_from_class(self.__class__))
- return loader.get_schema("ad_creatives")
+ schema = loader.get_schema("ad_creatives").copy()
+ schema["properties"] = schema["properties"].copy()
+ schema["properties"]["updated_time"] = {
+ "description": "The date and time when the parent ad was last updated.",
+ "type": ["null", "string"],
+ "format": "date-time",
+ }
+ return schema
def _get_creative_fields(self) -> List[str]:
"""Get the list of creative fields to request, excluding computed fields"""
@@ -123,22 +214,26 @@ def _get_creative_fields(self) -> List[str]:
json_schema = self.get_json_schema()
creative_fields = list(json_schema.get("properties", {}).keys())
- self._creative_fields = [f for f in creative_fields if f not in ("thumbnail_data_url", "account_id")]
+ self._creative_fields = [f for f in creative_fields if f not in ("thumbnail_data_url", "account_id", "updated_time")]
return self._creative_fields
def fields(self, **kwargs) -> List[str]:
"""Return fields to request from the ads endpoint - just id and creative reference"""
return self._fields
+ def _state_filter(self, stream_state: Mapping[str, Any]) -> Mapping[str, Any]:
+ """Only apply cursor filtering when an incremental state cursor exists."""
+ if not stream_state.get(self.cursor_field):
+ return {}
+ return super()._state_filter(stream_state)
+
def list_objects(self, params: Mapping[str, Any], account_id: str) -> Iterable:
return self._api.get_account(account_id=account_id).get_ads(params=params, fields=self.fields())
def _fetch_creative_details(self, creative_id: str) -> Optional[Mapping[str, Any]]:
"""Fetch full creative details by ID using the AdCreative API"""
try:
- creative = FBAdCreative(creative_id)
- creative_data = creative.api_get(fields=self._get_creative_fields())
- return creative_data.export_all_data()
+ return fetch_creative_with_object_story_spec_fallback(creative_id, self._get_creative_fields(), self.name)
except (FacebookRequestError, TypeError) as e:
logger.warning(f"Failed to fetch creative {creative_id}: {e}")
return None
@@ -157,19 +252,61 @@ def read_records(
) -> Iterable[Mapping[str, Any]]:
"""Read ads, extract unique creative IDs, and fetch full creative details"""
self._seen_creative_ids = set()
+ failed_creative_ids: Set[str] = set()
+ max_successful_cursor: Optional[Tuple[AirbyteDateTime, str]] = None
+ earliest_failed_cursor: Optional[AirbyteDateTime] = None
+ failed_ad_without_cursor = False
+
+ # The CDK passes persisted state to read_records whatever the configured sync mode, so a cursor left behind by
+ # an earlier incremental sync would otherwise filter a full refresh and make it silently partial.
+ if sync_mode != SyncMode.incremental:
+ stream_slice = {**stream_slice, "stream_state": {}}
+
+ # Bypass incremental read_records to checkpoint state after the full slice and creative fetches.
+ for ad_record in FBMarketingStream.read_records(self, sync_mode, cursor_field, stream_slice, stream_state):
+ updated_time = ad_record.get(self.cursor_field)
+ try:
+ parsed_updated_time = ab_datetime_parse(updated_time) if updated_time is not None else None
+ except (ValueError, TypeError):
+ # A malformed timestamp must not abort the whole account slice; treat it as a missing cursor.
+ logger.warning(
+ f"Stream {self.name}: ad {ad_record.get('id')} has an unparsable {self.cursor_field} "
+ f"{updated_time!r}; treating it as missing so the cursor cannot advance past this ad."
+ )
+ parsed_updated_time = None
- for ad_record in super().read_records(sync_mode, cursor_field, stream_slice, stream_state):
creative_id = ad_record.get("creative", {}).get("id")
- if not creative_id or creative_id in self._seen_creative_ids:
+ if not creative_id:
+ continue
+
+ if creative_id in failed_creative_ids:
+ if parsed_updated_time is None:
+ failed_ad_without_cursor = True
+ elif earliest_failed_cursor is None or parsed_updated_time < earliest_failed_cursor:
+ earliest_failed_cursor = parsed_updated_time
+ continue
+
+ if creative_id in self._seen_creative_ids:
+ if parsed_updated_time is not None and (max_successful_cursor is None or parsed_updated_time > max_successful_cursor[0]):
+ max_successful_cursor = (parsed_updated_time, updated_time)
continue
self._seen_creative_ids.add(creative_id)
creative_data = self._fetch_creative_details(creative_id)
if not creative_data:
+ failed_creative_ids.add(creative_id)
+ if parsed_updated_time is None:
+ failed_ad_without_cursor = True
+ elif earliest_failed_cursor is None or parsed_updated_time < earliest_failed_cursor:
+ earliest_failed_cursor = parsed_updated_time
continue
+ if parsed_updated_time is not None and (max_successful_cursor is None or parsed_updated_time > max_successful_cursor[0]):
+ max_successful_cursor = (parsed_updated_time, updated_time)
+
self.fix_date_time(creative_data)
+ creative_data[self.cursor_field] = updated_time
if self._fetch_thumbnail_images:
thumbnail_url = creative_data.get("thumbnail_url")
@@ -179,6 +316,35 @@ def read_records(
self.add_account_id(creative_data, stream_slice["account_id"])
yield creative_data
+ if failed_creative_ids:
+ logger.warning(
+ f"Stream {self.name}: {len(failed_creative_ids)} creative fetch(es) failed for account "
+ f"{stream_slice['account_id']}; the incremental cursor will not advance past the earliest failed ad, "
+ f"so the failed creatives are retried on the next sync. If the same creative fails on every sync, "
+ f"the cursor stays pinned and the stream keeps re-reading from that point."
+ )
+
+ # The CDK assigns persisted state and picks a checkpoint reader from the catalog's cursor_field alone, so a
+ # full refresh would otherwise emit a real cursor and let a retried attempt resume filtered and partial.
+ if sync_mode != SyncMode.incremental:
+ return
+
+ if max_successful_cursor is None or failed_ad_without_cursor:
+ return
+
+ max_parsed, max_raw = max_successful_cursor
+ if earliest_failed_cursor is not None and max_parsed >= earliest_failed_cursor:
+ # Facebook cursors are second-precision and the filter is a strict GREATER_THAN, so rewinding one second
+ # before the earliest failure re-reads every ad at that timestamp without ever skipping a success.
+ checkpoint_value = str(earliest_failed_cursor - timedelta(seconds=1))
+ else:
+ checkpoint_value = max_raw
+
+ self.state = self._get_updated_state(
+ self.state,
+ {"account_id": stream_slice["account_id"], self.cursor_field: checkpoint_value},
+ )
+
class CustomConversions(FBMarketingStream):
"""doc: https://developers.facebook.com/docs/marketing-api/reference/custom-conversion"""
@@ -382,8 +548,8 @@ class AdsInsightsRegion(AdsInsights):
breakdowns = ["region"]
-class AdsInsightsDma(AdsInsights):
- breakdowns = ["dma"]
+class AdsInsightsComscoreMarket(AdsInsights):
+ breakdowns = ["comscore_market"]
class AdsInsightsPlatformAndDevice(AdsInsights):
@@ -449,8 +615,8 @@ class AdsInsightsDemographicsCountry(AdsInsights):
action_breakdowns = ["action_type"]
-class AdsInsightsDemographicsDMARegion(AdsInsights):
- breakdowns = ["dma"]
+class AdsInsightsDemographicsComscoreMarketRegion(AdsInsights):
+ breakdowns = ["comscore_market"]
action_breakdowns = ["action_type"]
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_api.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_api.py
index 654cec6e6112..83012501a047 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_api.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_api.py
@@ -2,12 +2,19 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
+import json
from datetime import timedelta
+from http.client import RemoteDisconnected
import pytest
+import requests
import source_facebook_marketing
from facebook_business import FacebookAdsApi, FacebookSession
from facebook_business.adobjects.adaccount import AdAccount
+from facebook_business.exceptions import FacebookRequestError
+
+from airbyte_cdk.models import FailureType
+from airbyte_cdk.utils.traced_exception import AirbyteTracedException
FB_API_VERSION = FacebookAdsApi.API_VERSION
@@ -215,6 +222,46 @@ def test_parse_call_rate_header_handles_string_values(self, fb_api, headers, exp
assert usage == expected_usage
assert isinstance(usage, (int, float))
+ def test__parse_call_rate_header_reads_ad_account_reset_time(self, fb_api):
+ headers = {
+ "x-ad-account-usage": json.dumps({"acc_id_util_pct": 100, "reset_time_duration": 100, "ads_api_access_tier": "standard_access"})
+ }
+
+ usage, pause_interval = fb_api._parse_call_rate_header(headers)
+
+ assert usage == 100
+ assert pause_interval == timedelta(seconds=100)
+
+ def test__parse_call_rate_header_takes_the_worst_business_use_case_entry(self, fb_api):
+ headers = {
+ "x-business-use-case-usage": json.dumps(
+ {
+ "123": [
+ {
+ "type": "ads_management",
+ "call_count": 100,
+ "total_cputime": 20,
+ "total_time": 20,
+ "estimated_time_to_regain_access": 0,
+ },
+ {
+ "type": "ads_insights",
+ "call_count": 10,
+ "total_cputime": 5,
+ "total_time": 5,
+ "estimated_time_to_regain_access": 19,
+ },
+ ],
+ "456": None,
+ }
+ )
+ }
+
+ usage, pause_interval = fb_api._parse_call_rate_header(headers)
+
+ assert usage == 100
+ assert pause_interval == timedelta(minutes=19)
+
def test_update_insights_throttle_limit_casts_string_values(self, fb_api, mocker):
mock_response = mocker.Mock()
mock_response.headers.return_value = {"x-fb-ads-insights-throttle": '{"app_id_util_pct": "55.5", "acc_id_util_pct": "30"}'}
@@ -224,6 +271,229 @@ def test_update_insights_throttle_limit_casts_string_values(self, fb_api, mocker
assert isinstance(fb_api._ads_insights_throttle.per_application, float)
assert isinstance(fb_api._ads_insights_throttle.per_account, float)
+ @staticmethod
+ def _make_error(code, subcode=None, headers=None, is_transient=False):
+ error = {"message": "Ad Account Has Too Many API Calls", "code": code, "is_transient": is_transient}
+ if subcode is not None:
+ error["error_subcode"] = subcode
+ return FacebookRequestError(
+ message="Call was not successful",
+ request_context={},
+ http_status=400,
+ http_headers=headers or {},
+ body=json.dumps({"error": error}),
+ )
+
+ @pytest.mark.parametrize(
+ "code,subcode,expected",
+ [
+ (17, 2446079, True), # the observed "Ad Account Has Too Many API Calls" block
+ (17, 1234567, False), # same code, an unobserved subcode
+ (17, None, False),
+ (4, None, False), # app-level throttling isn't wired up yet
+ (100, 12345, False),
+ ],
+ )
+ def test__is_quota_block_error(self, fb_api, code, subcode, expected):
+ assert fb_api._is_quota_block_error(self._make_error(code, subcode)) == expected
+
+ def test__handle_quota_block_error_uses_header_derived_wait(self, mocker, fb_api):
+ headers = {
+ "x-business-use-case-usage": json.dumps(
+ {"act_123": [{"call_count": 100, "total_cputime": 100, "total_time": 100, "estimated_time_to_regain_access": 7}]}
+ )
+ }
+ exc = self._make_error(17, 2446079, headers=headers)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+ mocker.patch.object(source_facebook_marketing.api, "logger")
+
+ assert fb_api._handle_quota_block_error(exc) == timedelta(minutes=7)
+
+ source_facebook_marketing.api.sleep.assert_called_once_with(timedelta(minutes=7).total_seconds())
+ warning_message = source_facebook_marketing.api.logger.warning.call_args[0][0]
+ assert "code=17" in warning_message and "subcode=2446079" in warning_message
+
+ def test__handle_quota_block_error_caps_wait_at_max_pause_interval(self, mocker, fb_api):
+ headers = {
+ "x-business-use-case-usage": json.dumps(
+ {"act_123": [{"call_count": 100, "total_cputime": 100, "total_time": 100, "estimated_time_to_regain_access": 60}]}
+ )
+ }
+ exc = self._make_error(17, 2446079, headers=headers)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ assert fb_api._handle_quota_block_error(exc) == fb_api.MAX_PAUSE_INTERVAL
+
+ source_facebook_marketing.api.sleep.assert_called_once_with(fb_api.MAX_PAUSE_INTERVAL.total_seconds())
+
+ def test__handle_quota_block_error_falls_back_to_default_when_field_missing(self, mocker, fb_api):
+ exc = self._make_error(17, 2446079, headers={})
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ assert fb_api._handle_quota_block_error(exc) == fb_api.MAX_PAUSE_INTERVAL
+
+ source_facebook_marketing.api.sleep.assert_called_once_with(fb_api.MAX_PAUSE_INTERVAL.total_seconds())
+
+ def test__handle_quota_block_error_uses_ad_account_reset_time_when_no_business_estimate(self, mocker, fb_api):
+ headers = {"x-ad-account-usage": json.dumps({"acc_id_util_pct": 100, "reset_time_duration": 100})}
+ exc = self._make_error(17, 2446079, headers=headers)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ assert fb_api._handle_quota_block_error(exc) == timedelta(seconds=100)
+
+ source_facebook_marketing.api.sleep.assert_called_once_with(100.0)
+
+ def test__pause_if_usage_high_is_a_noop_when_pausing_disabled(self, mocker, fb_api):
+ fb_api.pause_on_rate_limit = False
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ fb_api._pause_if_usage_high(usage=100, pause_interval=timedelta(minutes=5))
+
+ source_facebook_marketing.api.sleep.assert_not_called()
+
+ def test__handle_failed_call_rate_limit_applies_generic_pause(self, mocker, fb_api):
+ headers = {"x-ad-account-usage": json.dumps({"acc_id_util_pct": 96})}
+ exc = self._make_error(100, 12345, headers=headers)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+ mocker.patch.object(source_facebook_marketing.api, "logger")
+
+ fb_api._handle_failed_call_rate_limit(exc)
+
+ source_facebook_marketing.api.sleep.assert_called_once_with(fb_api.MAX_PAUSE_INTERVAL.total_seconds())
+ source_facebook_marketing.api.logger.warning.assert_called_once()
+
+ def test__handle_failed_call_rate_limit_caps_wait_at_max_pause_interval(self, mocker, fb_api):
+ """Unlike the success path, this pause repeats on every @backoff_policy retry, so the
+ API-provided estimate must not be honoured beyond MAX_PAUSE_INTERVAL per attempt."""
+ headers = {
+ "x-business-use-case-usage": json.dumps(
+ {"act_123": [{"call_count": 100, "total_cputime": 100, "total_time": 100, "estimated_time_to_regain_access": 60}]}
+ )
+ }
+ exc = self._make_error(4, None, headers=headers)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ fb_api._handle_failed_call_rate_limit(exc)
+
+ source_facebook_marketing.api.sleep.assert_called_once_with(fb_api.MAX_PAUSE_INTERVAL.total_seconds())
+
+ def test__handle_failed_call_rate_limit_no_pause_when_usage_low(self, mocker, fb_api):
+ headers = {"x-ad-account-usage": json.dumps({"acc_id_util_pct": 10})}
+ exc = self._make_error(100, 12345, headers=headers)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ fb_api._handle_failed_call_rate_limit(exc)
+
+ source_facebook_marketing.api.sleep.assert_not_called()
+
+ def test_call_retries_quota_block_without_raising(self, mocker, fb_api):
+ """The error path must read the response headers and derive the wait from
+ `estimated_time_to_regain_access`, retrying the call itself rather than propagating --
+ this is what keeps the retry from being counted against @backoff_policy's max_tries."""
+ headers = {
+ "x-business-use-case-usage": json.dumps(
+ {"act_123": [{"call_count": 100, "total_cputime": 100, "total_time": 100, "estimated_time_to_regain_access": 2}]}
+ )
+ }
+ quota_error = self._make_error(17, 2446079, headers=headers)
+ success_response = mocker.Mock()
+ success_response.headers.return_value = {}
+
+ mock_super_call = mocker.patch.object(FacebookAdsApi, "call", side_effect=[quota_error, success_response])
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ response = source_facebook_marketing.api.MyFacebookAdsApi.call.__wrapped__(fb_api, method="GET", path=("act_123", "ads"), params={})
+
+ assert response is success_response
+ assert mock_super_call.call_count == 2
+ source_facebook_marketing.api.sleep.assert_called_once_with(timedelta(minutes=2).total_seconds())
+ # the success resets the wait budget for the next block episode
+ assert fb_api._quota_block_wait_elapsed == timedelta()
+
+ def test_call_gives_up_on_quota_block_after_max_wait(self, mocker, fb_api):
+ """A quota block that never clears must not loop forever: once cumulative quota-wait time
+ reaches MAX_QUOTA_BLOCK_WAIT, `call()` re-raises without pausing again, so the outer
+ @backoff_policy ladder gives up instead of retrying indefinitely."""
+ quota_error = self._make_error(17, 2446079, headers={})
+
+ mocker.patch.object(fb_api, "MAX_QUOTA_BLOCK_WAIT", timedelta(minutes=5))
+ # finite side effects: an unbounded loop dies on StopIteration instead of hanging the suite
+ mock_handle_quota_block = mocker.patch.object(fb_api, "_handle_quota_block_error", side_effect=[timedelta(minutes=6)])
+ mock_handle_failed = mocker.patch.object(fb_api, "_handle_failed_call_rate_limit")
+ mock_super_call = mocker.patch.object(FacebookAdsApi, "call", side_effect=[quota_error] * 3)
+
+ with pytest.raises(FacebookRequestError):
+ source_facebook_marketing.api.MyFacebookAdsApi.call.__wrapped__(fb_api, method="GET", path=("act_123", "ads"), params={})
+
+ # 1st failure: 0 min elapsed < 5 min cap -> retries, accrues 6 min.
+ # 2nd failure: 6 min elapsed >= 5 min cap -> re-raises; the budget is spent, so no extra pause.
+ assert mock_super_call.call_count == 2
+ assert mock_handle_quota_block.call_count == 1
+ mock_handle_failed.assert_not_called()
+
+ def test_call_quota_block_budget_spans_backoff_retries(self, mocker, fb_api):
+ """Through the DECORATED `call`: a quota block that never clears spends at most
+ MAX_QUOTA_BLOCK_WAIT in total, not MAX_QUOTA_BLOCK_WAIT per @backoff_policy try."""
+ quota_error = self._make_error(17, 2446079, headers={}, is_transient=True)
+ mock_super_call = mocker.patch.object(FacebookAdsApi, "call", side_effect=quota_error)
+ mocker.patch("time.sleep") # @backoff_policy's own expo waits
+ mock_sleep = mocker.patch.object(
+ source_facebook_marketing.api, "sleep", side_effect=[None] * 20 + [AssertionError("quota loop did not stop")]
+ )
+
+ # code 17 is a rate-limit code, so retry_pattern's give_up converts it before re-raising
+ with pytest.raises(AirbyteTracedException):
+ fb_api.call(method="GET", path=("act_123", "ads"), params={})
+
+ # No header -> each pause is MAX_PAUSE_INTERVAL: 1 h / 10 min = 6 pauses over 7 calls spend the
+ # budget in the first try; the 4 remaining backoff tries re-enter with it spent and fail fast.
+ pauses = fb_api.MAX_QUOTA_BLOCK_WAIT // fb_api.MAX_PAUSE_INTERVAL
+ assert mock_sleep.call_args_list == [mocker.call(fb_api.MAX_PAUSE_INTERVAL.total_seconds())] * pauses
+ assert mock_super_call.call_count == pauses + 1 + 4
+
+ def test_call_pauses_then_reraises_other_rate_limit_error(self, mocker, fb_api):
+ """A non-quota rate-limit FacebookRequestError gets the header-based pause and still
+ propagates out of `call()` so @backoff_policy's original expo ladder retries it."""
+ headers = {"x-ad-account-usage": json.dumps({"acc_id_util_pct": 96})}
+ rate_limit_error = self._make_error(4, None, headers=headers)
+
+ mocker.patch.object(FacebookAdsApi, "call", side_effect=rate_limit_error)
+ mock_handle_failed = mocker.patch.object(fb_api, "_handle_failed_call_rate_limit")
+
+ with pytest.raises(FacebookRequestError):
+ source_facebook_marketing.api.MyFacebookAdsApi.call.__wrapped__(fb_api, method="GET", path=("act_123", "ads"), params={})
+
+ mock_handle_failed.assert_called_once_with(rate_limit_error)
+
+ def test_call_reraises_non_rate_limit_error_without_pausing(self, mocker, fb_api):
+ """Errors outside FACEBOOK_RATE_LIMIT_ERROR_CODES (config errors, the HTTP 500 page-size
+ reduction path) must surface immediately even when the usage headers are high."""
+ headers = {"x-ad-account-usage": json.dumps({"acc_id_util_pct": 96})}
+ other_error = self._make_error(100, 12345, headers=headers)
+
+ mocker.patch.object(FacebookAdsApi, "call", side_effect=other_error)
+ mock_handle_failed = mocker.patch.object(fb_api, "_handle_failed_call_rate_limit")
+
+ with pytest.raises(FacebookRequestError):
+ source_facebook_marketing.api.MyFacebookAdsApi.call.__wrapped__(fb_api, method="GET", path=("act_123", "ads"), params={})
+
+ mock_handle_failed.assert_not_called()
+
+ def test_call_reraises_immediately_when_pausing_disabled(self, mocker, fb_api):
+ """The connection check turns pausing off: a quota block must surface at once instead of
+ sleeping into the platform's 9-minute check timeout."""
+ fb_api.pause_on_rate_limit = False
+ headers = {"x-ad-account-usage": json.dumps({"acc_id_util_pct": 100, "reset_time_duration": 100})}
+ quota_error = self._make_error(17, 2446079, headers=headers)
+ mock_super_call = mocker.patch.object(FacebookAdsApi, "call", side_effect=[quota_error] * 2)
+ mocker.patch.object(source_facebook_marketing.api, "sleep")
+
+ with pytest.raises(FacebookRequestError):
+ source_facebook_marketing.api.MyFacebookAdsApi.call.__wrapped__(fb_api, method="GET", path=("act_123", "ads"), params={})
+
+ assert mock_super_call.call_count == 1
+ source_facebook_marketing.api.sleep.assert_not_called()
+
def test_find_account(self, api, account_id, requests_mock):
requests_mock.register_uri(
"GET",
@@ -233,3 +503,61 @@ def test_find_account(self, api, account_id, requests_mock):
account = api.get_account(account_id)
assert isinstance(account, AdAccount)
assert account.get_id() == "act_test"
+
+
+class TestBackoffPolicyTransientNetworkErrors:
+ """The facebook_business SDK session bypasses the CDK HttpClient, so transport-level `requests`
+ exceptions must be retried by @backoff_policy itself."""
+
+ @pytest.fixture
+ def fb_api(self):
+ return source_facebook_marketing.api.MyFacebookAdsApi.init(access_token="foo", crash_log=False)
+
+ @pytest.fixture(autouse=True)
+ def no_backoff_sleep(self, mocker):
+ return mocker.patch("time.sleep")
+
+ @staticmethod
+ def _success_response(mocker):
+ response = mocker.Mock()
+ response.headers.return_value = {}
+ return response
+
+ @pytest.mark.parametrize(
+ "network_error",
+ [
+ requests.exceptions.ConnectionError(
+ ("Connection aborted.", RemoteDisconnected("Remote end closed connection without response"))
+ ),
+ requests.exceptions.ChunkedEncodingError("Connection broken: IncompleteRead(0 bytes read, 512 more expected)"),
+ requests.exceptions.ReadTimeout("Read timed out."),
+ ],
+ ids=["remote_disconnected", "chunked_encoding", "read_timeout"],
+ )
+ def test_call_retries_network_error_then_succeeds(self, mocker, fb_api, network_error):
+ success_response = self._success_response(mocker)
+ mock_super_call = mocker.patch.object(FacebookAdsApi, "call", side_effect=[network_error, network_error, success_response])
+ params = {"limit": 100}
+
+ response = fb_api.call(method="GET", path=("act_123", "insights"), params=params)
+
+ assert response is success_response
+ assert mock_super_call.call_count == 3
+ # page-size reduction only applies to FacebookRequestError, so the limit stays untouched
+ assert params["limit"] == 100
+ assert fb_api.request_record_limit_is_reduced is False
+
+ def test_call_raises_transient_error_when_network_retries_exhausted(self, mocker, fb_api):
+ network_error = requests.exceptions.ConnectionError(
+ ("Connection aborted.", RemoteDisconnected("Remote end closed connection without response"))
+ )
+ mock_super_call = mocker.patch.object(FacebookAdsApi, "call", side_effect=network_error)
+
+ with pytest.raises(AirbyteTracedException) as exc_info:
+ fb_api.call(method="GET", path=("act_123", "insights"), params={"limit": 100})
+
+ assert mock_super_call.call_count == 5
+ assert exc_info.value.failure_type == FailureType.transient_error
+ assert exc_info.value.message == "Network connection to the Facebook Marketing API was interrupted."
+ assert "ConnectionError persisted after 5 attempts" in exc_info.value.internal_message
+ assert "Remote end closed connection without response" in exc_info.value.internal_message
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job.py
index d7d04ccc74ec..2a2cf3a540c0 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job.py
@@ -3,7 +3,9 @@
#
import copy
+import importlib
import time
+import typing
from datetime import date, datetime, timedelta
import freezegun
@@ -15,10 +17,13 @@
from facebook_business.adobjects.adsinsights import AdsInsights
from facebook_business.adobjects.campaign import Campaign
from facebook_business.api import FacebookAdsApiBatch, FacebookBadObjectError
+from facebook_business.exceptions import FacebookRequestError
from source_facebook_marketing.api import MyFacebookAdsApi
from source_facebook_marketing.streams.async_job import InsightAsyncJob, ParentAsyncJob, Status, update_in_batch
+from source_facebook_marketing.streams.async_job_manager import APILimit
from source_facebook_marketing.utils import DateInterval
+from airbyte_cdk.models import FailureType
from airbyte_cdk.utils.datetime_helpers import ab_datetime_now
from airbyte_cdk.utils.traced_exception import AirbyteTracedException
@@ -254,6 +259,32 @@ def test_failed_execution(self, api, started_job, batch):
assert len(api.new_batch.return_value) == 49
assert batch.execute.call_count == 3
+ def test_parent_with_many_children_respects_batch_cap(self, api, started_job, mocker):
+ """ParentAsyncJob children must be batched under Meta's 50-per-batch limit.
+
+ Regression: previously update_in_batch checked size only between top-level
+ jobs, so a single ParentAsyncJob with 120 children would add 120 entries
+ to one batch and Meta would reject with GraphBatchException.
+ """
+ batches = [FacebookAdsApiBatch(api=api) for _ in range(3)]
+ for b in batches:
+ mocker.patch.object(b, "execute", return_value=None)
+ api.new_batch.side_effect = batches
+
+ parent = ParentAsyncJob(
+ jobs=[started_job for _ in range(120)],
+ api=api,
+ interval=DateInterval(date(2020, 1, 1), date(2020, 1, 2)),
+ )
+ parent._attempt_number = 1 # parent considered started when its children are
+
+ update_in_batch(api=api, jobs=[parent])
+
+ # 120 leaf updates split into batches of at most 50: 50 + 50 + 20.
+ assert [len(b) for b in batches] == [50, 50, 20]
+ for b in batches:
+ b.execute.assert_called_once()
+
class TestInsightAsyncJob:
"""Test InsightAsyncJob class"""
@@ -485,13 +516,11 @@ def fake_get_insights(params, is_async):
["ad_id", "c1", "c2", "c3", "c4"], # 4 non-PK -> mid=2
],
)
- def test_split_job_by_fields_parent_creates_children(self, mocker, api, fields):
+ def test_split_job_by_fields_parent_creates_children(self, api, fields):
"""
When the edge is Ad, _split_job() should return a list with a single ParentAsyncJob
that contains two child InsightAsyncJobs whose fields are split (PK + half/half).
"""
- from source_facebook_marketing.streams.async_job import InsightAsyncJob, ParentAsyncJob
-
interval = DateInterval(date(2010, 1, 1), date(2010, 1, 10))
params = {"time_increment": 1, "breakdowns": [], "fields": fields}
pk = ["ad_id"]
@@ -538,10 +567,10 @@ def test_split_job_by_fields_parent_creates_children(self, mocker, api, fields):
)
def test_split_job_by_fields_parent_not_enough_fields(self, api, fields):
"""
- If there are <=1 non-PK fields, splitting by fields is impossible and should raise.
+ If there are <=1 non-PK fields, splitting by fields is impossible. Without the
+ incrementality window this surfaces as an actionable config_error that names the
+ offending field and tells the user to unselect it (no incrementality guidance).
"""
- from source_facebook_marketing.streams.async_job import InsightAsyncJob
-
interval = DateInterval(date(2010, 1, 1), date(2010, 1, 10))
params = {"time_increment": 1, "breakdowns": [], "fields": fields}
pk = ["ad_id"]
@@ -555,12 +584,76 @@ def test_split_job_by_fields_parent_not_enough_fields(self, api, fields):
primary_key=pk,
)
- with pytest.raises(AirbyteTracedException, match="Unable to split the Facebook Insights request") as exc_info:
+ with pytest.raises(AirbyteTracedException, match="Facebook could not generate the Insights report") as exc_info:
job._split_job()
- from airbyte_cdk.models import FailureType
+ assert exc_info.value.failure_type == FailureType.config_error
+ # No incrementality window in params -> no incrementality guidance in the message.
+ assert "incrementality" not in exc_info.value.message.lower()
+ # The offending non-PK field (if any) is named so the user knows what to unselect.
+ for non_pk_field in [f for f in fields if f not in pk]:
+ assert non_pk_field in exc_info.value.message
- assert exc_info.value.failure_type == FailureType.system_error
+ def test_split_job_by_fields_parent_incrementality_raises_config_error(self, api):
+ """
+ When the unsplittable leaf has the `incrementality` attribution window, raise a
+ config_error that additionally guides the user to disable "Include Incrementality"
+ (the verified dma + conversions + incrementality limitation, oncall #12088).
+ """
+ interval = DateInterval(date(2010, 1, 1), date(2010, 1, 10))
+ params = {
+ "time_increment": 1,
+ "breakdowns": ["comscore_market"],
+ "fields": ["ad_id", "conversions"], # 1 non-PK field
+ "action_attribution_windows": ["1d_click", "incrementality"],
+ "level": "ad",
+ }
+ pk = ["ad_id"]
+
+ job = InsightAsyncJob(
+ api=api,
+ edge_object=Ad(1),
+ interval=interval,
+ params=params,
+ job_timeout=timedelta(minutes=60),
+ primary_key=pk,
+ stream_name="ads_insights_comscore_market",
+ )
+
+ with pytest.raises(AirbyteTracedException, match="incrementality") as exc_info:
+ job._split_job()
+
+ assert exc_info.value.failure_type == FailureType.config_error
+ assert "Include Incrementality" in exc_info.value.message
+ assert "comscore_market" in exc_info.value.message
+ assert "conversions" in exc_info.value.message
+ # The stream name is surfaced so the user knows exactly which stream to fix.
+ assert "ads_insights_comscore_market" in exc_info.value.message
+
+ def test_split_job_by_fields_parent_does_not_add_missing_breakdown_pk_fields(self, api):
+ interval = DateInterval(date(2010, 1, 1), date(2010, 1, 10))
+ params = {"time_increment": 1, "breakdowns": ["age", "gender"], "fields": ["ad_id", "clicks", "impressions"]}
+ pk = ["date_start", "account_id", "ad_id", "age", "gender"]
+
+ job = InsightAsyncJob(
+ api=api,
+ edge_object=Ad(1),
+ interval=interval,
+ params=params,
+ job_timeout=timedelta(minutes=60),
+ primary_key=pk,
+ )
+
+ parent = job._split_job()[0]
+
+ fields_a = parent._jobs[0]._params["fields"]
+ fields_b = parent._jobs[1]._params["fields"]
+ assert fields_a == ["ad_id", "clicks"]
+ assert fields_b == ["ad_id", "impressions"]
+ assert "age" not in fields_a
+ assert "gender" not in fields_a
+ assert "age" not in fields_b
+ assert "gender" not in fields_b
@freezegun.freeze_time("2023-10-29")
def test_collect_child_ids_start_failure_generic(self, mocker, api):
@@ -568,8 +661,6 @@ def test_collect_child_ids_start_failure_generic(self, mocker, api):
When get_insights raises a non-FacebookRequestError exception,
_collect_child_ids should wrap it in AirbyteTracedException with transient_error.
"""
- from airbyte_cdk.models import FailureType
-
job = InsightAsyncJob(
api=api,
edge_object=AdAccount(1),
@@ -591,12 +682,6 @@ def test_collect_child_ids_start_failure_facebook_request_error(self, mocker, ap
delegate to traced_exception() to preserve the correct FailureType classification
(e.g. config_error for invalid tokens, transient_error for rate limits).
"""
- from unittest.mock import PropertyMock
-
- from facebook_business.exceptions import FacebookRequestError
-
- from airbyte_cdk.models import FailureType
-
job = InsightAsyncJob(
api=api,
edge_object=AdAccount(1),
@@ -621,14 +706,31 @@ def test_collect_child_ids_start_failure_facebook_request_error(self, mocker, ap
# traced_exception classifies invalid token errors as config_error
assert exc_info.value.failure_type == FailureType.config_error
+ @freezegun.freeze_time("2023-10-29")
+ def test_collect_child_ids_polling_type_error(self, mocker, api):
+ job = InsightAsyncJob(
+ api=api,
+ edge_object=AdAccount(1),
+ interval=DateInterval(date(2023, 1, 1), date(2023, 1, 10)),
+ params={"time_increment": 1, "breakdowns": []},
+ job_timeout=timedelta(minutes=60),
+ )
+ malformed_run = mocker.MagicMock()
+ malformed_run.api_get.side_effect = TypeError("string indices must be integers, not 'str'")
+ mocker.patch.object(job._edge_object, "get_insights", return_value=malformed_run)
+
+ with pytest.raises(AirbyteTracedException, match="Facebook Insights API returned an invalid response") as exc_info:
+ job._collect_child_ids(pk_name="campaign_id", level="campaign")
+
+ assert exc_info.value.failure_type == FailureType.transient_error
+ assert "Failed to poll ID-collection job" in exc_info.value.internal_message
+
@freezegun.freeze_time("2023-10-29")
def test_collect_child_ids_all_attempts_exhausted(self, mocker, api):
"""
When every attempt returns Job Failed, _collect_child_ids should raise
AirbyteTracedException with transient_error after exhausting all retries.
"""
- from airbyte_cdk.models import FailureType
-
job = InsightAsyncJob(
api=api,
edge_object=AdAccount(1),
@@ -661,8 +763,6 @@ def test_collect_child_ids_result_fetch_failure(self, mocker, api):
When get_result raises FacebookBadObjectError, _collect_child_ids should
wrap it in AirbyteTracedException with transient_error.
"""
- from airbyte_cdk.models import FailureType
-
job = InsightAsyncJob(
api=api,
edge_object=AdAccount(1),
@@ -695,8 +795,6 @@ def test_collect_child_ids_no_child_ids(self, mocker, api):
When _collect_child_ids returns an empty list, _split_by_edge_class should
raise AirbyteTracedException with system_error.
"""
- from airbyte_cdk.models import FailureType
-
job = InsightAsyncJob(
api=api,
edge_object=AdAccount(1),
@@ -729,8 +827,6 @@ def test_collect_child_ids_timeout(self, mocker, api):
When job polling exceeds the timeout, _collect_child_ids should raise
AirbyteTracedException with transient_error.
"""
- from airbyte_cdk.models import FailureType
-
job = InsightAsyncJob(
api=api,
edge_object=AdAccount(1),
@@ -942,11 +1038,6 @@ class TestAPILimitTypeAnnotation:
def test_start_method_apilimit_annotation_resolves(self, cls_name):
"""The 'APILimit' string annotation on .start() must resolve
to the real class when the proper namespace is provided."""
- import importlib
- import typing
-
- from source_facebook_marketing.streams.async_job_manager import APILimit
-
mod = importlib.import_module("source_facebook_marketing.streams.async_job")
cls = getattr(mod, cls_name)
# Provide the module globals + APILimit so get_type_hints can resolve the forward ref,
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job_manager.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job_manager.py
index 1ccb3304e16b..9af41ce40914 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job_manager.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_async_job_manager.py
@@ -4,6 +4,7 @@
import pytest
from facebook_business.api import FacebookAdsApiBatch
+from facebook_business.exceptions import FacebookBadObjectError
from source_facebook_marketing.api import MyFacebookAdsApi
from source_facebook_marketing.streams.async_job import InsightAsyncJob, ParentAsyncJob
from source_facebook_marketing.streams.async_job_manager import APILimit, InsightAsyncJobManager
@@ -398,3 +399,44 @@ def test_try_consume_does_not_refresh_when_capacity_reached(self, mocker, api):
# No throttle refresh should have been attempted
api.get_account.assert_not_called()
+
+ def test_refresh_throttle_swallows_facebook_bad_object_error(self, mocker, api, caplog):
+ """
+ When Facebook returns a malformed response on the throttle-refresh ping,
+ the SDK raises ``FacebookBadObjectError``. The ping is best-effort, so
+ ``refresh_throttle`` must log the failure and keep the previous estimate
+ instead of bubbling the exception up and killing the sync.
+ """
+ acct = mocker.Mock()
+ acct.get_insights.side_effect = FacebookBadObjectError("Bad data to set object data")
+ api.get_account.return_value = acct
+ # Ensure the throttle attribute is never consulted on the failing path.
+ api.api.ads_insights_throttle = MyFacebookAdsApi.Throttle(99.0, 99.0)
+
+ limit = APILimit(api=api, account_id="act_bad", throttle_limit=90.0, max_jobs=10)
+ # Pretend a previous successful refresh cached 30.0.
+ limit._current_throttle = 30.0
+
+ with caplog.at_level("WARNING"):
+ limit.refresh_throttle()
+
+ # Previous cached estimate is retained, not overwritten with the stale 99.0.
+ assert limit.current_throttle == 30.0
+ assert any("malformed response" in record.message for record in caplog.records)
+ # Subsequent try_consume() should succeed because the cached estimate is below the limit.
+ assert limit.try_consume() is True
+
+ def test_refresh_throttle_reraises_unexpected_errors(self, mocker, api):
+ """
+ Only ``FacebookBadObjectError`` is treated as recoverable in the throttle
+ refresh path. Any other exception must propagate so credential/network
+ problems are surfaced normally.
+ """
+ acct = mocker.Mock()
+ acct.get_insights.side_effect = RuntimeError("boom")
+ api.get_account.return_value = acct
+
+ limit = APILimit(api=api, account_id="act_other", throttle_limit=90.0, max_jobs=10)
+
+ with pytest.raises(RuntimeError, match="boom"):
+ limit.refresh_throttle()
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_insight_streams.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_insight_streams.py
index 45c96d54a30f..ca9d53070192 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_insight_streams.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_base_insight_streams.py
@@ -2,6 +2,7 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
+import copy
import logging
from datetime import date, datetime, timedelta
@@ -9,7 +10,7 @@
from facebook_business.exceptions import FacebookRequestError
from freezegun import freeze_time
from source_facebook_marketing.spec import InsightConfig, TimeIncrementPeriod, ValidBreakdowns
-from source_facebook_marketing.streams import AdsInsights
+from source_facebook_marketing.streams import AdsInsights, AdsInsightsAgeAndGender, AdsInsightsCountry
from source_facebook_marketing.streams.async_job import AsyncJob, InsightAsyncJob
from source_facebook_marketing.utils import DateInterval
@@ -54,6 +55,19 @@ def async_job_mock_fixture(mocker):
mock.side_effect = lambda api, **kwargs: {"api": api, **kwargs}
+def _complete_insight_slice(stream, mocker, account_id, interval_start):
+ job = mocker.Mock(spec=InsightAsyncJob)
+ job.get_result.return_value = []
+ job.interval = DateInterval(interval_start, interval_start)
+
+ return list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"insight_job": job, "account_id": account_id},
+ )
+ )
+
+
class TestBaseInsightsStream:
def test_init(self, api, some_config):
stream = AdsInsights(
@@ -124,6 +138,67 @@ def test_include_incrementality(self, api, some_config, include_incrementality,
assert stream.action_attribution_windows == expected_windows
assert stream.request_params()["action_attribution_windows"] == expected_windows
+ @pytest.mark.parametrize(
+ "include_engaged_view,expected_windows",
+ [
+ pytest.param(
+ False,
+ ["1d_click", "7d_click", "28d_click", "1d_view"],
+ id="disabled_uses_default_windows",
+ ),
+ pytest.param(
+ True,
+ ["1d_click", "7d_click", "28d_click", "1d_view", "1d_ev"],
+ id="enabled_appends_ev_windows",
+ ),
+ ],
+ )
+ def test_include_engaged_view(self, api, some_config, include_engaged_view, expected_windows):
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ insights_lookback_window=28,
+ include_engaged_view=include_engaged_view,
+ )
+
+ assert stream.action_attribution_windows == expected_windows
+ assert stream.request_params()["action_attribution_windows"] == expected_windows
+
+ @pytest.mark.parametrize(
+ "include_incrementality,include_engaged_view,expected_windows",
+ [
+ pytest.param(
+ True,
+ True,
+ ["1d_click", "7d_click", "28d_click", "1d_view", "incrementality", "1d_ev"],
+ id="both_enabled",
+ ),
+ pytest.param(
+ False,
+ False,
+ ["1d_click", "7d_click", "28d_click", "1d_view"],
+ id="both_disabled",
+ ),
+ ],
+ )
+ def test_include_incrementality_and_engaged_view(
+ self, api, some_config, include_incrementality, include_engaged_view, expected_windows
+ ):
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ insights_lookback_window=28,
+ include_incrementality=include_incrementality,
+ include_engaged_view=include_engaged_view,
+ )
+
+ assert stream.action_attribution_windows == expected_windows
+ assert stream.request_params()["action_attribution_windows"] == expected_windows
+
def test_init_statuses(self, api, some_config):
stream = AdsInsights(
api=api,
@@ -167,6 +242,160 @@ def test_read_records_all(self, mocker, api, some_config):
assert len(records) == 3
+ @freeze_time("2026-09-30")
+ def test_cursor_does_not_regress_while_completing_lookback_slices(self, mocker, api, some_config):
+ account_id = some_config["account_ids"][0]
+ cursor = date(2026, 9, 20)
+ stream = AdsInsights(
+ api=api,
+ account_ids=[account_id],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime(2026, 9, 29),
+ insights_lookback_window=28,
+ )
+ stream.state = {account_id: {"date_start": cursor.isoformat(), "slices": []}}
+
+ for offset in [-28, -26, -27, -25, -24]:
+ _complete_insight_slice(stream, mocker, account_id, cursor + timedelta(days=offset))
+ assert date.fromisoformat(stream.state[account_id]["date_start"]) >= cursor
+
+ resumed_stream = AdsInsights(
+ api=api,
+ account_ids=[account_id],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime(2026, 9, 29),
+ insights_lookback_window=28,
+ )
+ resumed_stream.state = stream.state
+ assert resumed_stream._get_start_date()[account_id] == cursor - timedelta(days=28)
+
+ @freeze_time("2026-09-30")
+ def test_stale_slices_are_removed_and_lookback_dates_are_still_requested(self, mocker, api, some_config, async_job_mock):
+ account_id = some_config["account_ids"][0]
+ cursor = date(2026, 9, 20)
+ end_date = date(2026, 9, 25)
+ stream = AdsInsights(
+ api=api,
+ account_ids=[account_id],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime.combine(end_date, datetime.min.time()),
+ insights_lookback_window=28,
+ )
+ stream.state = {
+ account_id: {
+ "date_start": cursor.isoformat(),
+ "slices": [(cursor - timedelta(days=days)).isoformat() for days in [19, 12, 11, 10]],
+ }
+ }
+ assert stream.state[account_id]["slices"] == []
+
+ stale_slice = cursor - timedelta(days=29)
+ _complete_insight_slice(stream, mocker, account_id, stale_slice)
+ assert stale_slice in stream._completed_slices[account_id]
+ assert stream.state[account_id]["slices"] == []
+ assert stale_slice in stream._completed_slices[account_id]
+
+ generated_jobs = list(stream._generate_async_jobs(params={}, account_id=account_id))
+ expected_dates = [cursor - timedelta(days=28) + timedelta(days=offset) for offset in range((end_date - cursor).days + 29)]
+ assert {job["interval"].start for job in generated_jobs} == set(expected_dates)
+
+ completion_order = expected_dates[::2] + expected_dates[1::2]
+ for interval_start in completion_order:
+ _complete_insight_slice(stream, mocker, account_id, interval_start)
+
+ assert stream.state[account_id]["date_start"] == end_date.isoformat()
+ assert stream.state[account_id]["slices"] == []
+
+ @freeze_time("2026-09-30")
+ def test_completed_slices_past_gap_remain_in_state(self, mocker, api, some_config):
+ account_id = some_config["account_ids"][0]
+ cursor = date(2026, 9, 20)
+ stream = AdsInsights(
+ api=api,
+ account_ids=[account_id],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime(2026, 9, 29),
+ insights_lookback_window=28,
+ )
+ stream.state = {account_id: {"date_start": cursor.isoformat(), "slices": []}}
+
+ for offset in [*range(-28, 3), 4]:
+ _complete_insight_slice(stream, mocker, account_id, cursor + timedelta(days=offset))
+
+ assert stream.state[account_id]["date_start"] == (cursor + timedelta(days=2)).isoformat()
+ assert stream.state[account_id]["slices"] == [(cursor + timedelta(days=4)).isoformat()]
+
+ @freeze_time("2026-09-30")
+ def test_monthly_cursor_advances_from_snapped_first_slice(self, mocker, api, some_config):
+ account_id = some_config["account_ids"][0]
+ cursor = date(2026, 8, 1)
+ stream = AdsInsights(
+ api=api,
+ account_ids=[account_id],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime(2026, 9, 20),
+ insights_lookback_window=28,
+ time_increment_period=TimeIncrementPeriod.monthly,
+ )
+ stream.state = {
+ account_id: {"date_start": cursor.isoformat(), "slices": []},
+ "time_increment": 30,
+ "time_increment_period": "monthly",
+ }
+
+ for interval_start in [date(2026, 7, 1), date(2026, 8, 1), date(2026, 9, 1)]:
+ _complete_insight_slice(stream, mocker, account_id, interval_start)
+
+ assert stream.state[account_id]["date_start"] == "2026-09-01"
+
+ @freeze_time("2026-09-30")
+ def test_weekly_cursor_advances_with_non_aligned_lookback(self, mocker, api, some_config):
+ account_id = some_config["account_ids"][0]
+ cursor = date(2026, 9, 21)
+ stream = AdsInsights(
+ api=api,
+ account_ids=[account_id],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime(2026, 9, 30),
+ insights_lookback_window=10,
+ time_increment_period=TimeIncrementPeriod.weekly,
+ )
+ stream.state = {
+ account_id: {"date_start": cursor.isoformat(), "slices": []},
+ "time_increment": 7,
+ "time_increment_period": "weekly",
+ }
+
+ for interval_start in [date(2026, 9, 7), date(2026, 9, 14), date(2026, 9, 21), date(2026, 9, 28)]:
+ _complete_insight_slice(stream, mocker, account_id, interval_start)
+
+ assert stream.state[account_id]["date_start"] == "2026-09-28"
+
+ @freeze_time("2026-09-30")
+ def test_cursor_progress_is_independent_between_accounts(self, mocker, api):
+ first_account, second_account = "first_account", "second_account"
+ first_cursor, second_cursor = date(2026, 9, 20), date(2026, 9, 10)
+ stream = AdsInsights(
+ api=api,
+ account_ids=[first_account, second_account],
+ start_date=datetime(2026, 1, 1),
+ end_date=datetime(2026, 9, 29),
+ insights_lookback_window=28,
+ )
+ stream.state = {
+ first_account: {"date_start": first_cursor.isoformat(), "slices": []},
+ second_account: {"date_start": second_cursor.isoformat(), "slices": []},
+ }
+
+ for offset in [-28, -26, -27]:
+ _complete_insight_slice(stream, mocker, first_account, first_cursor + timedelta(days=offset))
+ assert date.fromisoformat(stream.state[first_account]["date_start"]) >= first_cursor
+ assert date.fromisoformat(stream.state[second_account]["date_start"]) == second_cursor
+
+ _complete_insight_slice(stream, mocker, second_account, second_cursor - timedelta(days=28))
+ assert date.fromisoformat(stream.state[second_account]["date_start"]) >= second_cursor
+ assert date.fromisoformat(stream.state[first_account]["date_start"]) >= first_cursor
+
def test_read_records_random_order(self, mocker, api, some_config):
"""1. yield all from mock
2. if read slice 2, 3 state not changed
@@ -246,10 +475,7 @@ def test_read_records_add_account_id(self, mocker, api, some_config):
{
"unknown_account": {
AdsInsights.cursor_field: "2010-10-03",
- "slices": [
- "2010-01-01",
- "2010-01-02",
- ],
+ "slices": [],
},
"time_increment": 1,
},
@@ -292,7 +518,13 @@ def test_read_records_add_account_id(self, mocker, api, some_config):
},
"time_increment": 1,
},
- None,
+ {
+ "unknown_account": {
+ AdsInsights.cursor_field: "2010-10-03",
+ "slices": [],
+ },
+ "time_increment": 1,
+ },
),
(
{
@@ -584,6 +816,85 @@ def test_fields_custom(self, api, some_config):
]
)
+ def test_fields_exclude_breakdowns_from_configured_json_schema(self, api, some_config):
+ stream = AdsInsightsAgeAndGender(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ insights_lookback_window=28,
+ )
+ stream.configured_json_schema = {
+ "properties": {
+ "account_id": {"type": ["null", "string"]},
+ "age": {"type": ["null", "string"]},
+ "gender": {"type": ["null", "string"]},
+ "impressions": {"type": ["null", "integer"]},
+ }
+ }
+
+ params = stream.request_params()
+
+ assert params["breakdowns"] == ["age", "gender"]
+ assert "age" not in params["fields"]
+ assert "gender" not in params["fields"]
+ assert params["fields"] == ["account_id", "impressions"]
+
+ def test_fields_exclude_breakdowns_from_custom_fields(self, api, some_config):
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ fields=["account_id", "age", "gender", "impressions"],
+ breakdowns=["age", "gender"],
+ insights_lookback_window=28,
+ )
+
+ params = stream.request_params()
+
+ assert params["breakdowns"] == ["age", "gender"]
+ assert params["fields"] == ["account_id", "impressions"]
+
+ def test_fields_exclude_object_breakdown_ids_from_configured_json_schema(self, api, some_config):
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ breakdowns=["body_asset"],
+ insights_lookback_window=28,
+ )
+ stream.configured_json_schema = {
+ "properties": {
+ "account_id": {"type": ["null", "string"]},
+ "body_asset": {"type": ["null", "object"]},
+ "body_asset_id": {"type": ["null", "string"]},
+ "impressions": {"type": ["null", "integer"]},
+ }
+ }
+
+ params = stream.request_params()
+
+ assert params["breakdowns"] == ["body_asset"]
+ assert params["fields"] == ["account_id", "impressions"]
+
+ def test_fields_exclude_object_breakdown_ids_from_custom_fields(self, api, some_config):
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ fields=["account_id", "body_asset", "body_asset_id", "impressions"],
+ breakdowns=["body_asset"],
+ insights_lookback_window=28,
+ )
+
+ params = stream.request_params()
+
+ assert params["breakdowns"] == ["body_asset"]
+ assert params["fields"] == ["account_id", "impressions"]
+
@pytest.mark.parametrize(
"custom_fields, expected_in_schema, expected_not_in_schema",
[
@@ -750,6 +1061,85 @@ def test_objective_results_renamed_from_results(self, api, some_config, custom_f
transformed_record = stream._transform_objective_results(record)
assert transformed_record == expected_record
+ def test_get_json_schema_built_once(self, mocker, api, some_config):
+ """Schema files are loaded only on the first call, not for every record."""
+ get_schema_spy = mocker.spy(ResourceSchemaLoader, "get_schema")
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ fields=["objective_results", "impressions"],
+ breakdowns=["country"],
+ insights_lookback_window=28,
+ )
+
+ for _ in range(100):
+ stream.get_json_schema()
+ stream._transform_objective_results({"results": [], "impressions": 100})
+
+ loaded = [call.args[1] for call in get_schema_spy.call_args_list]
+ assert loaded == ["ads_insights", "ads_insights_custom_fields", "ads_insights_breakdowns"]
+
+ @pytest.mark.parametrize(
+ "stream_class, kwargs, expected_properties",
+ [
+ pytest.param(
+ AdsInsights,
+ {"fields": ["objective_results", "impressions"], "breakdowns": ["country"]},
+ {"objective_results", "impressions", "country", "date_start", "date_stop", "account_id", "ad_id"},
+ id="custom_fields_and_breakdowns",
+ ),
+ pytest.param(
+ AdsInsights,
+ {"fields": ["impressions"], "breakdowns": ["country"], "level": "campaign"},
+ {"impressions", "country", "date_start", "date_stop", "account_id", "campaign_id"},
+ id="custom_fields_campaign_level",
+ ),
+ pytest.param(AdsInsightsCountry, {}, None, id="builtin_breakdown_subclass"),
+ ],
+ )
+ def test_get_json_schema_cached_matches_uncached(self, api, some_config, stream_class, kwargs, expected_properties):
+ """Cached schema is identical to a fresh build and stays unchanged across calls and record transforms."""
+ stream = stream_class(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ insights_lookback_window=28,
+ **kwargs,
+ )
+
+ first = copy.deepcopy(stream.get_json_schema())
+ stream.fields()
+ stream._transform_objective_results({"results": [], "impressions": 100})
+ dict(stream.get_json_schema())
+
+ assert stream.get_json_schema() is stream.get_json_schema()
+ assert stream.get_json_schema() == first
+ assert stream.get_json_schema() == stream_class._json_schema.func(stream)
+ if expected_properties is not None:
+ assert set(stream.get_json_schema()["properties"]) == expected_properties
+ else:
+ assert "country" in stream.get_json_schema()["properties"]
+
+ def test_objective_results_rename_decision_computed_once(self, mocker, api, some_config):
+ """The schema-based rename decision is made once per stream, not per record."""
+ stream = AdsInsights(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2010, 1, 1),
+ end_date=datetime(2011, 1, 1),
+ fields=["objective_results", "impressions"],
+ insights_lookback_window=28,
+ )
+ get_json_schema_spy = mocker.spy(stream, "get_json_schema")
+
+ records = [stream._transform_objective_results({"results": [{"value": str(i)}]}) for i in range(10)]
+
+ assert records == [{"objective_results": [{"value": str(i)}]} for i in range(10)]
+ assert get_json_schema_spy.call_count == 1
+
def test_level_custom(self, api, some_config):
stream = AdsInsights(
api=api,
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_config_migrations.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_config_migrations.py
index ffe5867339b5..4cf1979fafd9 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_config_migrations.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_config_migrations.py
@@ -241,6 +241,21 @@ def test_should_not_migrate_new_access_token_config(self):
migration_instance = MigrateSecretsPathInConnector()
assert not migration_instance._should_migrate(new_config)
+ def test_does_not_overwrite_existing_credentials_access_token(self):
+ config = {
+ "account_ids": ["01234567890"],
+ "access_token": "stale_top_level_token",
+ "credentials": {
+ "auth_type": "Client",
+ "client_id": "id",
+ "client_secret": "secret",
+ "access_token": "valid_oauth_token",
+ },
+ }
+ migrated = MigrateSecretsPathInConnector._transform(config)
+ assert migrated["credentials"]["access_token"] == "valid_oauth_token"
+ assert migrated["access_token"] == "stale_top_level_token"
+
class TestRemoveActionReportTimeMigration:
OLD_TEST_CONFIG = _config_path(f"{_REMOVE_ACTION_REPORT_TIME_CONFIGS_PATH}/test_old_config.json")
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_errors.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_errors.py
index 3100f2299d59..c0a9ccc129d2 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_errors.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_errors.py
@@ -242,7 +242,9 @@
(
"error_400_invalid_oauth_access_token_cannot_parse",
"The access token for this connection is invalid or corrupted. "
- "Please re-authenticate your Facebook connection in Airbyte. "
+ "This may be caused by browser autofill overwriting the OAuth token with saved credentials. "
+ "Please re-authenticate your Facebook connection by clicking 'Authenticate your account' and saving the configuration. "
+ "See https://docs.airbyte.com/integrations/sources/facebook-marketing#connection-check-fails-with-invalid-access-token-after-re-authenticating for details. "
"If re-authentication does not resolve the issue, go to facebook.com > Settings > Business Integrations, "
"remove the Airbyte app, and then re-authenticate again.",
{
@@ -719,3 +721,81 @@ def test_traced_exception_without_api_error():
assert isinstance(result, AirbyteTracedException)
assert result.message == "Error code 408: Call was unsuccessful. The Facebook API has imploded."
assert result.failure_type == FailureType.system_error
+
+
+ERROR_USER_TITLE = "First Dof Value Should Match Object Story Spec Field"
+ERROR_USER_MSG = (
+ "For a Degrees of freedom enabled ad, the first value of Asset Feed Spec field "
+ "should match the corresponding field in Object Story Spec."
+)
+
+
+@pytest.mark.parametrize(
+ "error_body, expected_message",
+ (
+ (
+ {
+ "message": "Invalid parameter",
+ "code": 100,
+ "error_subcode": 2446211,
+ "error_user_title": ERROR_USER_TITLE,
+ "error_user_msg": ERROR_USER_MSG,
+ },
+ f"Error code 100 (subcode 2446211): Invalid parameter. Facebook details: {ERROR_USER_TITLE}. {ERROR_USER_MSG}",
+ ),
+ (
+ {
+ "message": "Invalid parameter",
+ "code": 100,
+ "error_user_title": ERROR_USER_TITLE,
+ "error_user_msg": ERROR_USER_MSG,
+ },
+ f"Error code 100: Invalid parameter. Facebook details: {ERROR_USER_TITLE}. {ERROR_USER_MSG}",
+ ),
+ (
+ {
+ "message": "Invalid parameter",
+ "code": 100,
+ "error_subcode": 2446211,
+ "error_user_msg": ERROR_USER_MSG,
+ },
+ f"Error code 100 (subcode 2446211): Invalid parameter. Facebook details: {ERROR_USER_MSG}",
+ ),
+ (
+ {"message": "Invalid parameter", "code": 100, "error_subcode": 2446211},
+ "Error code 100: Invalid parameter.",
+ ),
+ (
+ {
+ "message": "Invalid parameter",
+ "code": 100,
+ "error_subcode": 2446211,
+ "error_user_title": ERROR_USER_TITLE,
+ "error_user_msg": ERROR_USER_TITLE,
+ },
+ f"Error code 100 (subcode 2446211): Invalid parameter. Facebook details: {ERROR_USER_TITLE}.",
+ ),
+ ),
+ ids=(
+ "title_and_msg_with_subcode",
+ "title_and_msg_without_subcode",
+ "msg_only_with_subcode",
+ "no_user_fields_with_subcode",
+ "duplicate_title_and_msg",
+ ),
+)
+def test_traced_exception_fallback_includes_user_facing_details(error_body, expected_message):
+ error = FacebookRequestError(
+ message="Call was not successful",
+ request_context={},
+ http_status=400,
+ http_headers={},
+ body=json.dumps({"error": error_body}),
+ )
+
+ result = traced_exception(error)
+
+ assert isinstance(result, AirbyteTracedException)
+ assert result.message == expected_message
+ assert result.failure_type == FailureType.system_error
+ assert result.internal_message == "Invalid parameter"
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_patches.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_patches.py
new file mode 100644
index 000000000000..ad7cee94575d
--- /dev/null
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_patches.py
@@ -0,0 +1,207 @@
+#
+# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
+#
+
+"""Tests for CursorPatch.load_next_page() type guards.
+
+These tests verify that CursorPatch handles malformed Facebook API responses
+gracefully instead of raising TypeError when response data is not dict-typed.
+"""
+
+from unittest.mock import MagicMock
+
+import pytest
+from source_facebook_marketing.streams.patches import CursorPatch
+
+from airbyte_cdk.utils import AirbyteTracedException
+
+
+def _make_cursor_patch(response_json, include_summary=False):
+ """Create a CursorPatch instance with a mocked API call returning the given response."""
+ api = MagicMock()
+ response_obj = MagicMock()
+ response_obj.json.return_value = response_json
+ response_obj.headers.return_value = {}
+ api.call.return_value = response_obj
+
+ cursor = object.__new__(CursorPatch)
+ cursor._api = api
+ cursor._path = "/test"
+ cursor.params = {}
+ cursor._finished_iteration = False
+ cursor._include_summary = include_summary
+ cursor._queue = []
+ cursor._headers = {}
+ cursor._total_count = 0
+ cursor._summary = {}
+ cursor._object_parser = MagicMock()
+ cursor._object_parser.parse_multiple.return_value = []
+ return cursor
+
+
+class TestCursorPatchResponseTypeGuard:
+ """Test that non-dict responses raise AirbyteTracedException."""
+
+ def test_string_response_raises_traced_exception(self):
+ cursor = _make_cursor_patch("some string response")
+ with pytest.raises(AirbyteTracedException) as exc_info:
+ cursor.load_next_page()
+ assert exc_info.value.failure_type.value == "transient_error"
+ assert "not a JSON object" in exc_info.value.message
+
+ def test_none_response_raises_traced_exception(self):
+ cursor = _make_cursor_patch(None)
+ with pytest.raises(AirbyteTracedException) as exc_info:
+ cursor.load_next_page()
+ assert exc_info.value.failure_type.value == "transient_error"
+
+ def test_list_response_raises_traced_exception(self):
+ cursor = _make_cursor_patch([{"data": "item"}])
+ with pytest.raises(AirbyteTracedException) as exc_info:
+ cursor.load_next_page()
+ assert exc_info.value.failure_type.value == "transient_error"
+
+ def test_integer_response_raises_traced_exception(self):
+ cursor = _make_cursor_patch(12345)
+ with pytest.raises(AirbyteTracedException) as exc_info:
+ cursor.load_next_page()
+ assert exc_info.value.failure_type.value == "transient_error"
+
+
+class TestCursorPatchPagingTypeGuard:
+ """Test that non-dict 'paging' values are handled safely."""
+
+ def test_paging_as_string_does_not_raise_and_marks_finished(self):
+ response = {"data": [], "paging": "not-a-dict"}
+ cursor = _make_cursor_patch(response)
+ original_path, original_params = cursor._path, dict(cursor.params)
+ cursor.load_next_page()
+ assert cursor._finished_iteration is True
+ assert cursor._path == original_path
+ assert cursor.params == original_params
+
+ def test_paging_as_none_marks_finished(self):
+ response = {"data": [], "paging": None}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ assert cursor._finished_iteration is True
+
+ def test_paging_as_list_marks_finished(self):
+ response = {"data": [], "paging": ["next"]}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ assert cursor._finished_iteration is True
+
+ def test_valid_paging_extracts_next_url(self):
+ response = {
+ "data": [{"id": "1"}],
+ "paging": {"next": "https://graph.facebook.com/v25.0/act_123/ads?after=cursor123&limit=25"},
+ }
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ assert cursor._finished_iteration is False
+ assert "after" in cursor.params
+ assert cursor.params["after"] == "cursor123"
+
+ def test_paging_without_next_marks_finished(self):
+ response = {"data": [{"id": "1"}], "paging": {"cursors": {"before": "abc"}}}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ assert cursor._finished_iteration is True
+
+
+class TestCursorPatchDataItemsTypeGuard:
+ """Test that non-dict items in 'data' array are filtered out."""
+
+ def test_string_items_filtered_from_data(self):
+ response = {"data": ["bad_string", {"id": "1"}, "another_bad"]}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ # After filtering, only the dict item should remain
+ assert response["data"] == [{"id": "1"}]
+
+ def test_mixed_non_dict_items_filtered(self):
+ response = {"data": [123, None, {"id": "2"}, True, {"id": "3"}]}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ assert response["data"] == [{"id": "2"}, {"id": "3"}]
+
+ def test_all_dict_items_preserved(self):
+ response = {"data": [{"id": "1"}, {"id": "2"}, {"id": "3"}]}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ assert response["data"] == [{"id": "1"}, {"id": "2"}, {"id": "3"}]
+
+ def test_empty_data_list_no_error(self):
+ response = {"data": []}
+ cursor = _make_cursor_patch(response)
+ result = cursor.load_next_page()
+ assert result is False
+
+ def test_data_not_a_list_passes_through(self):
+ """When data is not a list, let SDK's parse_multiple handle it."""
+ response = {"data": {"id": "single"}}
+ cursor = _make_cursor_patch(response)
+ cursor.load_next_page()
+ # No filtering applied, parse_multiple called with original response
+ cursor._object_parser.parse_multiple.assert_called_once_with(response)
+
+
+class TestCursorPatchSummaryTypeGuard:
+ """Test that non-dict 'summary' values are handled safely."""
+
+ def test_summary_as_string_ignored(self):
+ response = {"data": [], "summary": "not-a-dict"}
+ cursor = _make_cursor_patch(response, include_summary=True)
+ cursor.load_next_page()
+ assert cursor._summary == {}
+ assert cursor._total_count == 0
+
+ def test_summary_as_none_ignored(self):
+ response = {"data": [], "summary": None}
+ cursor = _make_cursor_patch(response, include_summary=True)
+ cursor.load_next_page()
+ assert cursor._summary == {}
+
+ def test_valid_summary_extracted(self):
+ response = {"data": [], "summary": {"total_count": 42}}
+ cursor = _make_cursor_patch(response, include_summary=True)
+ cursor.load_next_page()
+ assert cursor._total_count == 42
+ assert cursor._summary == {"total_count": 42}
+
+ def test_summary_not_extracted_when_include_summary_false(self):
+ response = {"data": [], "summary": {"total_count": 42}}
+ cursor = _make_cursor_patch(response, include_summary=False)
+ cursor.load_next_page()
+ assert cursor._total_count == 0
+ assert cursor._summary == {}
+
+
+class TestCursorPatchNormalOperation:
+ """Test that normal/valid responses still work correctly."""
+
+ def test_normal_response_with_data_and_paging(self):
+ response = {
+ "data": [{"id": "1"}, {"id": "2"}],
+ "paging": {"next": "https://graph.facebook.com/v25.0/act_123/ads?after=xyz&limit=50"},
+ }
+ cursor = _make_cursor_patch(response)
+ cursor._object_parser.parse_multiple.return_value = [MagicMock(), MagicMock()]
+ result = cursor.load_next_page()
+ assert result is True
+ assert cursor._finished_iteration is False
+
+ def test_last_page_response(self):
+ response = {"data": [{"id": "1"}]}
+ cursor = _make_cursor_patch(response)
+ cursor._object_parser.parse_multiple.return_value = [MagicMock()]
+ result = cursor.load_next_page()
+ assert result is True
+ assert cursor._finished_iteration is True
+
+ def test_finished_iteration_returns_false(self):
+ cursor = _make_cursor_patch({"data": []})
+ cursor._finished_iteration = True
+ result = cursor.load_next_page()
+ assert result is False
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_source.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_source.py
index 5bd6d1bafe21..47d756aaa34f 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_source.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_source.py
@@ -22,6 +22,7 @@
Status,
SyncMode,
)
+from airbyte_cdk.sources.utils.schema_helpers import check_config_against_spec_or_exit
from .utils import command_check
@@ -82,6 +83,32 @@ def test_check_connection_find_account_was_called(self, api_find_account, config
assert ok
assert not error_msg
+ def test_check_connection_disables_rate_limit_pauses(self, api, config, logger_mock, fb_marketing):
+ """The platform fails a check that has not finished within 9 minutes, so the check must not wait out rate limits."""
+ ok, error_msg = fb_marketing.check_connection(logger_mock, config=config)
+
+ assert ok and not error_msg
+ assert api.return_value.api.pause_on_rate_limit is False
+
+ def test_check_connection_rate_limited_account_fails_fast(self, requests_mock, mocker, config, logger_mock, fb_marketing):
+ """End to end through the real API: a blocked ad account surfaces the connector's rate-limit message
+ after the backoff ladder alone (5 calls), without any rate-limit pause."""
+ requests_mock.register_uri(
+ "GET",
+ FacebookSession.GRAPH + f"/{FacebookAdsApi.API_VERSION}/act_123/",
+ status_code=400,
+ json={"error": {"code": 17, "error_subcode": 2446079, "message": "Ad Account Has Too Many API Calls", "is_transient": False}},
+ headers={"x-ad-account-usage": '{"acc_id_util_pct": 100, "reset_time_duration": 600}'},
+ )
+ sleep_mock = mocker.patch("source_facebook_marketing.api.sleep")
+
+ ok, error_msg = fb_marketing.check_connection(logger_mock, config=config)
+
+ assert ok is False
+ assert error_msg.startswith("The maximum number of requests on the Facebook API has been reached")
+ sleep_mock.assert_not_called()
+ assert len([r for r in requests_mock.request_history if "/act_123/" in r.url]) == 5
+
def test_check_connection_future_date_range(self, api, config, logger_mock, fb_marketing):
config["start_date"] = "2219-10-10T00:00:00"
config["end_date"] = "2219-10-11T00:00:00"
@@ -142,6 +169,43 @@ def test_get_custom_insights_streams(self, api, config, fb_marketing):
config = ConnectorConfig.parse_obj(config)
assert fb_marketing.get_custom_insights_streams(api, config)
+ @pytest.mark.parametrize(
+ "breakdowns",
+ [
+ pytest.param(["publisher_platform", "device_platform", "age", "gender", "country"], id="configured-order"),
+ pytest.param(["country", "gender", "age", "device_platform", "publisher_platform"], id="reverse-order"),
+ ],
+ )
+ def test_get_custom_insights_streams_preserves_breakdowns_order(self, api, config, fb_marketing, breakdowns):
+ config["custom_insights"] = [
+ {
+ "name": "ordered",
+ "fields": ["ad_id", "account_id", "spend"],
+ "breakdowns": [*breakdowns, breakdowns[0]],
+ "action_breakdowns": ["action_type", "action_destination", "action_type"],
+ },
+ ]
+ streams = fb_marketing.get_custom_insights_streams(api, ConnectorConfig.parse_obj(config))
+ stream = streams[0]
+
+ assert stream.breakdowns == breakdowns
+ assert stream.action_breakdowns == ["action_type", "action_destination"]
+ assert stream.primary_key == ["date_start", "account_id", "ad_id", *breakdowns]
+ assert stream.fields() == ["ad_id", "account_id", "spend"]
+
+ def test_get_custom_insights_streams_preserves_fields_order(self, api, config, fb_marketing):
+ config["custom_insights"] = [
+ {
+ "name": "ordered_fields",
+ "fields": ["ad_id", "account_id", "spend", "ad_id"],
+ "breakdowns": [],
+ "action_breakdowns": [],
+ },
+ ]
+ streams = fb_marketing.get_custom_insights_streams(api, ConnectorConfig.parse_obj(config))
+
+ assert streams[0].fields() == ["ad_id", "account_id", "spend"]
+
def test_get_custom_insights_streams_with_time_increment_period(self, api, config, fb_marketing):
config["custom_insights"] = [
{
@@ -184,6 +248,33 @@ def test_get_custom_insights_action_breakdowns_allow_empty(self, api, config, fb
assert streams[0].breakdowns == ["ad_format_asset"]
assert streams[0].action_breakdowns == []
+ def test_deprecated_dma_breakdown_removed_from_spec(self, fb_marketing):
+ # Meta replaced `dma` with `comscore_market` (oncall #12940). `dma` must no longer be a
+ # selectable breakdown, so a Custom Insights config still using it is rejected by the CDK's
+ # config-vs-spec validation. `comscore_market` remains available as the replacement.
+ spec = fb_marketing.spec(None).connectionSpecification
+ breakdowns_enum = spec["properties"]["custom_insights"]["items"]["properties"]["breakdowns"]["items"]["enum"]
+ assert "dma" not in breakdowns_enum
+ assert "comscore_market" in breakdowns_enum
+
+ def test_dma_breakdown_config_rejected_with_config_error(self, config, fb_marketing):
+ """Validate the actual error users see when their saved config still references dma."""
+ config["custom_insights"] = [
+ {
+ "name": "test_dma_stream",
+ "fields": ["account_id"],
+ "breakdowns": ["dma"],
+ "action_breakdowns": ["action_type"],
+ },
+ ]
+ source_spec = fb_marketing.spec(None)
+ with pytest.raises(AirbyteTracedException) as exc_info:
+ check_config_against_spec_or_exit(config, source_spec)
+
+ assert exc_info.value.failure_type.value == "config_error"
+ assert "dma" in exc_info.value.message
+ assert "Config validation error" in exc_info.value.message
+
def test_read_missing_stream(self, config, api, logger_mock, fb_marketing):
catalog = ConfiguredAirbyteCatalog(
streams=[
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_spec.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_spec.py
new file mode 100644
index 000000000000..b272fdee419e
--- /dev/null
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_spec.py
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
+#
+
+import pytest
+from source_facebook_marketing import SourceFacebookMarketing
+
+
+@pytest.fixture
+def spec_properties():
+ spec = SourceFacebookMarketing().spec(None)
+ return spec.connectionSpecification["properties"]
+
+
+def _access_token_descriptions(properties):
+ descriptions = [properties["access_token"]["description"]]
+ for option in properties["credentials"]["oneOf"]:
+ descriptions.append(option["properties"]["access_token"]["description"])
+ return descriptions
+
+
+def test_access_token_descriptions_recommend_system_user_token(spec_properties):
+ for description in _access_token_descriptions(spec_properties):
+ assert "read_insights" not in description
+ assert '"Marketing API" then "Tools"' not in description
+ assert "System users" in description
+ assert "ads_read" in description
+ assert "ads_management" in description
+
+
+def test_start_date_description_mentions_37_months(spec_properties):
+ description = spec_properties["start_date"]["description"]
+ assert "37 months" in description
+ assert "2 years" not in description
diff --git a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_streams.py
index ac334eab5e1e..2e8fcb5c2693 100644
--- a/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_streams.py
+++ b/airbyte-integrations/connectors/source-facebook-marketing/unit_tests/test_streams.py
@@ -2,31 +2,49 @@
# Copyright (c) 2023 Airbyte, Inc., all rights reserved.
#
-from datetime import timedelta
+import json
+from datetime import datetime, timedelta, timezone
from unittest.mock import MagicMock, patch
+from urllib.parse import urlencode
import pytest
+from facebook_business.api import FacebookAdsApi
from facebook_business.exceptions import FacebookRequestError
+from facebook_business.session import FacebookSession
from source_facebook_marketing import SourceFacebookMarketing
from source_facebook_marketing.api import MyFacebookAdsApi
from source_facebook_marketing.streams import (
+ AdCreatives,
AdSets,
AdsInsights,
AdsInsightsActionType,
AdsInsightsAgeAndGender,
+ AdsInsightsComscoreMarket,
AdsInsightsCountry,
- AdsInsightsDma,
AdsInsightsPlatformAndDevice,
AdsInsightsRegion,
)
from source_facebook_marketing.streams.base_streams import FBMarketingStream
from source_facebook_marketing.streams.streams import AdAccount, AdCreativesFromAds, fetch_thumbnail_data_url
-from airbyte_cdk.models import FailureType
+from airbyte_cdk.models import FailureType, SyncMode
from airbyte_cdk.utils import AirbyteTracedException
from airbyte_cdk.utils.datetime_helpers import ab_datetime_now
+def test_ad_creatives_from_ads_schema_scopes_parent_updated_time(api, some_config):
+ direct_stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ ads_stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=None,
+ end_date=None,
+ )
+
+ assert "updated_time" not in direct_stream.get_json_schema()["properties"]
+ assert "updated_time" in ads_stream.get_json_schema()["properties"]
+
+
def test_filter_all_statuses(api, mocker, some_config):
mocker.patch.multiple(FBMarketingStream, __abstractmethods__=set())
expected = {}
@@ -106,8 +124,8 @@ def test_parse_call_rate_header():
["action_type", "action_target_id", "action_destination"],
],
[
- AdsInsightsDma,
- ["dma"],
+ AdsInsightsComscoreMarket,
+ ["comscore_market"],
["action_type", "action_target_id", "action_destination"],
],
[
@@ -270,7 +288,7 @@ def test_ads_insights_default_breakdowns_based_on_config_input(default_ads_insig
)
def test_fetch_creative_details_handles_exceptions(api, some_config, exception, should_raise):
"""Test that _fetch_creative_details handles exceptions based on HTTP status: 500 returns None, all others raise."""
- stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"])
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
with patch("source_facebook_marketing.streams.streams.FBAdCreative") as mock_creative_cls:
mock_creative_instance = MagicMock()
@@ -287,7 +305,7 @@ def test_fetch_creative_details_handles_exceptions(api, some_config, exception,
def test_fetch_creative_details_returns_data_on_success(api, some_config):
"""Test that _fetch_creative_details returns creative data on successful API call."""
- stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"])
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
expected_data = {"id": "12345", "name": "Test Creative", "body": "Test body"}
with patch("source_facebook_marketing.streams.streams.FBAdCreative") as mock_creative_cls:
@@ -300,6 +318,525 @@ def test_fetch_creative_details_returns_data_on_success(api, some_config):
assert result == expected_data
+def test_ad_creatives_from_ads_request_params_include_status_and_cursor_filters(api, some_config):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=None,
+ end_date=None,
+ filter_statuses=["ACTIVE"],
+ )
+
+ params = stream.request_params(stream_state={"updated_time": "2021-01-23T00:00:00+00:00", "filter_statuses": ["ACTIVE"]})
+
+ assert params["filtering"] == [
+ {
+ "field": "ad.effective_status",
+ "operator": "IN",
+ "value": ["ACTIVE"],
+ },
+ {
+ "field": "ad.updated_time",
+ "operator": "GREATER_THAN",
+ "value": 1611360000,
+ },
+ ]
+
+
+def test_ad_creatives_from_ads_request_params_skip_cursor_on_first_sync_without_start_date(api, some_config):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=None,
+ end_date=None,
+ filter_statuses=["ACTIVE"],
+ )
+
+ assert stream.request_params(stream_state={}) == {
+ "limit": 100,
+ "filtering": [
+ {
+ "field": "ad.effective_status",
+ "operator": "IN",
+ "value": ["ACTIVE"],
+ }
+ ],
+ }
+
+
+def test_ad_creatives_from_ads_request_params_skip_cursor_on_first_sync_with_start_date(api, some_config):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2021, 2, 1, tzinfo=timezone.utc),
+ end_date=None,
+ filter_statuses=["ACTIVE"],
+ )
+
+ assert stream.request_params(stream_state={}) == {
+ "limit": 100,
+ "filtering": [
+ {
+ "field": "ad.effective_status",
+ "operator": "IN",
+ "value": ["ACTIVE"],
+ }
+ ],
+ }
+
+
+def test_ad_creatives_from_ads_request_params_use_state_cursor_over_start_date(api, some_config):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=datetime(2021, 2, 1, tzinfo=timezone.utc),
+ end_date=None,
+ filter_statuses=["ACTIVE"],
+ )
+
+ params = stream.request_params(stream_state={"updated_time": "2021-01-23T00:00:00+00:00", "filter_statuses": ["ACTIVE"]})
+
+ assert params["filtering"] == [
+ {
+ "field": "ad.effective_status",
+ "operator": "IN",
+ "value": ["ACTIVE"],
+ },
+ {
+ "field": "ad.updated_time",
+ "operator": "GREATER_THAN",
+ "value": 1611360000,
+ },
+ ]
+
+
+def test_ad_creatives_from_ads_full_refresh_ignores_state_cursor(api, some_config, mocker):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=None,
+ end_date=None,
+ filter_statuses=["ACTIVE"],
+ )
+ list_objects = mocker.patch.object(stream, "list_objects", return_value=iter([]))
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.full_refresh,
+ stream_slice={
+ "account_id": some_config["account_ids"][0],
+ "stream_state": {
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "filter_statuses": ["ACTIVE"],
+ },
+ },
+ stream_state={
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "filter_statuses": ["ACTIVE"],
+ },
+ )
+ )
+
+ assert list_objects.call_args.kwargs["params"] == {
+ "limit": 100,
+ "filtering": [
+ {
+ "field": "ad.effective_status",
+ "operator": "IN",
+ "value": ["ACTIVE"],
+ }
+ ],
+ }
+
+
+def test_ad_creatives_from_ads_emits_parent_updated_time_and_advances_state(api, some_config, mocker):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=None,
+ end_date=None,
+ )
+ parent_ads = [
+ {
+ "id": "ad-1",
+ "creative": {"id": "creative-1"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": some_config["account_ids"][0],
+ },
+ {
+ "id": "ad-2",
+ "creative": {"id": "creative-2"},
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": some_config["account_ids"][0],
+ },
+ {
+ "id": "ad-3",
+ "creative": {"id": "creative-1"},
+ "updated_time": "2021-01-24T00:00:00+00:00",
+ "account_id": some_config["account_ids"][0],
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(
+ stream,
+ "_fetch_creative_details",
+ side_effect=lambda creative_id: {"id": creative_id},
+ )
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": some_config["account_ids"][0], "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ assert records == [
+ {"id": "creative-1", "updated_time": "2021-01-23T00:00:00+00:00", "account_id": some_config["account_ids"][0]},
+ {"id": "creative-2", "updated_time": "2021-01-25T00:00:00+00:00", "account_id": some_config["account_ids"][0]},
+ ]
+ assert stream.state[some_config["account_ids"][0]]["updated_time"] == "2021-01-25T00:00:00+00:00"
+
+
+def test_ad_creatives_from_ads_parent_without_updated_time_does_not_crash(api, some_config, mocker):
+ stream = AdCreativesFromAds(
+ api=api,
+ account_ids=some_config["account_ids"],
+ start_date=None,
+ end_date=None,
+ )
+ parent_ads = [{"id": "ad-1", "creative": {"id": "creative-1"}}]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", return_value={"id": "creative-1"})
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": some_config["account_ids"][0], "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ assert records[0]["updated_time"] is None
+ assert stream.state == {}
+
+
+def test_ad_creatives_from_ads_failed_fetch_does_not_advance_past_failed_cursor(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-success-before-failure",
+ "creative": {"id": "creative-success-before-failure"},
+ "updated_time": "2021-01-22T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-success-after-failure",
+ "creative": {"id": "creative-success-after-failure"},
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-failure",
+ "creative": {"id": "creative-failure"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(
+ stream,
+ "_fetch_creative_details",
+ side_effect=[
+ {"id": "creative-success-before-failure"},
+ {"id": "creative-success-after-failure"},
+ None,
+ ],
+ )
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ # The latest success (01-25) sits after the failure, so the cursor rewinds to one second before it.
+ assert stream.state[account_id]["updated_time"] == "2021-01-22T23:59:59+00:00"
+
+
+def test_ad_creatives_from_ads_all_failed_fetches_leave_state_untouched(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-failure-1",
+ "creative": {"id": "creative-failure-1"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-failure-2",
+ "creative": {"id": "creative-failure-2"},
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", return_value=None)
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ assert stream.state == {}
+
+
+def test_ad_creatives_from_ads_repeated_failed_creative_remains_a_failure(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-success",
+ "creative": {"id": "creative-success"},
+ "updated_time": "2021-01-22T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-failure",
+ "creative": {"id": "creative-failure"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-repeated-failure",
+ "creative": {"id": "creative-failure"},
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ fetch_creative_details = mocker.patch.object(
+ stream,
+ "_fetch_creative_details",
+ side_effect=[{"id": "creative-success"}, None],
+ )
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ fetch_creative_details.assert_has_calls([mocker.call("creative-success"), mocker.call("creative-failure")])
+ assert fetch_creative_details.call_count == 2
+ assert stream.state[account_id]["updated_time"] == "2021-01-22T00:00:00+00:00"
+
+
+def test_ad_creatives_from_ads_ad_without_creative_does_not_hold_cursor_back(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-without-creative",
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-success",
+ "creative": {"id": "creative-success"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", return_value={"id": "creative-success"})
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ assert stream.state[account_id]["updated_time"] == "2021-01-23T00:00:00+00:00"
+
+
+def test_ad_creatives_from_ads_success_equal_to_failed_cursor_rewinds_before_failure(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-success",
+ "creative": {"id": "creative-success"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-failure",
+ "creative": {"id": "creative-failure"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", side_effect=[{"id": "creative-success"}, None])
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ # Checkpointing the shared timestamp would filter the failed creative out of the next sync forever, so the
+ # cursor must land strictly before it. The GREATER_THAN filter then re-reads both ads at 2021-01-23.
+ assert stream.state[account_id]["updated_time"] == "2021-01-22T23:59:59+00:00"
+
+
+def test_ad_creatives_from_ads_failed_ad_without_cursor_blocks_checkpointing(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-success",
+ "creative": {"id": "creative-success"},
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-failure-without-updated-time",
+ "creative": {"id": "creative-failure"},
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", side_effect=[{"id": "creative-success"}, None])
+
+ list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ # A failed creative with no cursor cannot be placed on the timeline, so no cursor is safe to checkpoint.
+ assert stream.state == {}
+
+
+def test_ad_creatives_from_ads_re_referenced_successful_creative_advances_cursor(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-1",
+ "creative": {"id": "creative-1"},
+ "updated_time": "2021-01-20T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-2",
+ "creative": {"id": "creative-2"},
+ "updated_time": "2021-01-24T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-3",
+ "creative": {"id": "creative-1"},
+ "updated_time": "2021-01-28T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", side_effect=lambda creative_id: {"id": creative_id})
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ # ad-3 is deduplicated away, but it is the only source of the slice's latest cursor.
+ assert [record["id"] for record in records] == ["creative-1", "creative-2"]
+ assert stream.state[account_id]["updated_time"] == "2021-01-28T00:00:00+00:00"
+
+
+@pytest.mark.parametrize("sync_mode", ["full_refresh", SyncMode.full_refresh], ids=["string", "enum"])
+def test_ad_creatives_from_ads_full_refresh_does_not_advance_state(api, some_config, mocker, sync_mode):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-1",
+ "creative": {"id": "creative-1"},
+ "updated_time": "2021-01-23T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ {
+ "id": "ad-2",
+ "creative": {"id": "creative-2"},
+ "updated_time": "2021-01-25T00:00:00+00:00",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", side_effect=lambda creative_id: {"id": creative_id})
+
+ records = list(
+ stream.read_records(
+ sync_mode=sync_mode,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ # The CDK checkpoints whatever state the stream exposes, so a full refresh must not publish a cursor:
+ # a retried attempt would otherwise resume filtered and silently return a partial full refresh.
+ assert len(records) == 2
+ assert stream.state == {}
+
+
+def test_ad_creatives_from_ads_unparsable_updated_time_is_treated_as_missing(api, some_config, mocker):
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ account_id = some_config["account_ids"][0]
+ parent_ads = [
+ {
+ "id": "ad-malformed",
+ "creative": {"id": "creative-1"},
+ "updated_time": "not-a-date",
+ "account_id": account_id,
+ },
+ ]
+ mocker.patch("source_facebook_marketing.streams.base_streams.FBMarketingStream.read_records", return_value=iter(parent_ads))
+ mocker.patch.object(stream, "_fetch_creative_details", return_value={"id": "creative-1"})
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.incremental,
+ stream_slice={"account_id": account_id, "stream_state": {}},
+ stream_state={},
+ )
+ )
+
+ # A malformed timestamp from the API must not abort the account slice; the record is still emitted and the
+ # unusable cursor is simply never checkpointed.
+ assert [record["id"] for record in records] == ["creative-1"]
+ assert stream.state == {}
+
+
@pytest.mark.parametrize(
"exception,expected_behavior,expected_raise_type",
[
@@ -426,3 +963,244 @@ def test_ad_account_list_objects_handles_facebook_and_traced_exceptions(
elif expected_behavior == "remove_funding_source_details":
stream.list_objects(params={}, account_id=account_id)
assert mock_account_instance.api_get.call_count == 2
+
+
+def _object_story_spec_read_error(subcode):
+ """Build a Facebook 400 error body matching the Degrees-of-Freedom object_story_spec read failure."""
+ return {
+ "error": {
+ "message": "Invalid parameter",
+ "type": "OAuthException",
+ "code": 100,
+ "error_subcode": subcode,
+ "is_transient": False,
+ "error_user_title": "First Dof Value Should Match Object Story Spec Field",
+ "error_user_msg": "For a Degrees of freedom enabled ad, the first value of Asset Feed Spec field "
+ "should match the corresponding field in Object Story Spec.",
+ }
+ }
+
+
+def _facebook_request_error(error_body, status_code=400):
+ return FacebookRequestError(
+ message=error_body["error"]["message"],
+ request_context={},
+ http_status=status_code,
+ http_headers={},
+ body=json.dumps(error_body),
+ )
+
+
+def _graph_next_url(url, after, fields):
+ """Graph API `next` links repeat the whole request query, not only `after`."""
+ query = {"access_token": "unknown_token", "fields": fields, "limit": 100, "summary": "true", "after": after}
+ return f"{url}?{urlencode(query)}"
+
+
+@pytest.mark.parametrize("error_subcode", [2446211, 1443048])
+def test_fetch_creative_details_object_story_spec_fallback(api, some_config, error_subcode):
+ """A creative whose stored object_story_spec fails validation is re-fetched without that field."""
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ expected_data = {"id": "12345", "name": "Test Creative"}
+ exception = AirbyteTracedException(
+ message="Facebook error", exception=_facebook_request_error(_object_story_spec_read_error(error_subcode))
+ )
+
+ with patch("source_facebook_marketing.streams.streams.FBAdCreative") as mock_creative_cls:
+ mock_creative_instance = MagicMock()
+ mock_creative_cls.return_value = mock_creative_instance
+ mock_creative_instance.api_get.side_effect = [exception, mock_creative_instance]
+ mock_creative_instance.export_all_data.return_value = expected_data
+
+ result = stream._fetch_creative_details("12345")
+
+ assert result == expected_data
+ assert mock_creative_instance.api_get.call_count == 2
+ first_fields = mock_creative_instance.api_get.call_args_list[0].kwargs["fields"]
+ second_fields = mock_creative_instance.api_get.call_args_list[1].kwargs["fields"]
+ assert "object_story_spec" in first_fields
+ assert "object_story_spec" not in second_fields
+
+
+def test_fetch_creative_details_unrelated_400_does_not_fallback(api, some_config):
+ """A 400 with a different error_subcode still propagates and api_get is called only once."""
+ stream = AdCreativesFromAds(api=api, account_ids=some_config["account_ids"], start_date=None, end_date=None)
+ exception = AirbyteTracedException(message="Facebook error", exception=_facebook_request_error(_object_story_spec_read_error(33)))
+
+ with patch("source_facebook_marketing.streams.streams.FBAdCreative") as mock_creative_cls:
+ mock_creative_instance = MagicMock()
+ mock_creative_cls.return_value = mock_creative_instance
+ mock_creative_instance.api_get.side_effect = exception
+
+ with pytest.raises(AirbyteTracedException):
+ stream._fetch_creative_details("12345")
+
+ assert mock_creative_instance.api_get.call_count == 1
+
+
+def test_ad_creatives_object_story_spec_failed_page_reread(api, some_config, requests_mock, account_id):
+ """A page that fails on object_story_spec is re-read creative by creative without losing other records."""
+ stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ fields_csv = ",".join(stream.fields())
+ base_url = f"{FacebookSession.GRAPH}/{FacebookAdsApi.API_VERSION}/"
+ creatives_url = f"{base_url}act_{account_id}/adcreatives"
+
+ page1 = {
+ "json": {
+ "data": [{"id": "c1"}, {"id": "c2"}],
+ "paging": {"cursors": {"after": "A"}, "next": _graph_next_url(creatives_url, "A", fields_csv)},
+ },
+ "status_code": 200,
+ }
+ failed_page = {"json": _object_story_spec_read_error(2446211), "status_code": 400}
+ id_page = {
+ "json": {
+ "data": [{"id": "c3"}, {"id": "c4"}],
+ "paging": {"cursors": {"after": "B"}, "next": _graph_next_url(creatives_url, "B", "id")},
+ },
+ "status_code": 200,
+ }
+ page_after_b = {"json": {"data": [{"id": "c5"}]}, "status_code": 200}
+ requests_mock.register_uri("GET", creatives_url, [page1, failed_page, id_page, page_after_b])
+
+ requests_mock.register_uri("GET", f"{base_url}c3/", json={"id": "c3", "object_story_spec": {"link_data": {"link": "x"}}})
+ requests_mock.register_uri(
+ "GET",
+ f"{base_url}c4/",
+ [
+ {"json": _object_story_spec_read_error(2446211), "status_code": 400},
+ {"json": {"id": "c4", "name": "creative 4"}},
+ ],
+ )
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.full_refresh,
+ stream_state={},
+ stream_slice={"account_id": account_id},
+ )
+ )
+
+ assert [r["id"] for r in records] == ["c1", "c2", "c3", "c4", "c5"]
+ assert records[2]["object_story_spec"] == {"link_data": {"link": "x"}}
+ assert "object_story_spec" not in records[3]
+
+ edge_requests = [r for r in requests_mock.request_history if r.path.endswith("/adcreatives")]
+ assert len(edge_requests) == 4
+ assert edge_requests[0].qs["fields"] == [fields_csv]
+ assert "after" not in edge_requests[0].qs
+ assert edge_requests[0].qs["limit"] == ["100"]
+ assert edge_requests[1].qs["after"] == ["a"]
+ assert edge_requests[1].qs["fields"] == [fields_csv]
+ assert edge_requests[2].qs["fields"] == ["id"]
+ assert edge_requests[2].qs["after"] == ["a"]
+ assert edge_requests[2].qs["limit"] == ["100"]
+ assert edge_requests[3].qs["after"] == ["b"]
+ assert edge_requests[3].qs["fields"] == [fields_csv]
+
+ c4_requests = [r for r in requests_mock.request_history if r.path.endswith("/c4/")]
+ assert len(c4_requests) == 2
+ assert "object_story_spec" in c4_requests[0].qs["fields"][0]
+ assert "object_story_spec" not in c4_requests[1].qs["fields"][0]
+
+
+def test_ad_creatives_object_story_spec_last_page_fails(api, some_config, requests_mock, account_id):
+ """When the last page fails, the id page keeps the failed page's `after` (no `next`), so the stream ends instead of re-reading it."""
+ stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ base_url = f"{FacebookSession.GRAPH}/{FacebookAdsApi.API_VERSION}/"
+ creatives_url = f"{base_url}act_{account_id}/adcreatives"
+
+ page1 = {
+ "json": {
+ "data": [{"id": "c1"}],
+ "paging": {"cursors": {"after": "A"}, "next": _graph_next_url(creatives_url, "A", ",".join(stream.fields()))},
+ },
+ "status_code": 200,
+ }
+ failed_page = {"json": _object_story_spec_read_error(2446211), "status_code": 400}
+ # Facebook keeps cursors.after on the last page and only omits "next".
+ id_page = {"json": {"data": [{"id": "c2"}], "paging": {"cursors": {"after": "Z"}}}, "status_code": 200}
+ requests_mock.register_uri("GET", creatives_url, [page1, failed_page, id_page, failed_page])
+ requests_mock.register_uri("GET", f"{base_url}c2/", json={"id": "c2"})
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.full_refresh,
+ stream_state={},
+ stream_slice={"account_id": account_id},
+ )
+ )
+
+ assert [r["id"] for r in records] == ["c1", "c2"]
+ edge_requests = [r for r in requests_mock.request_history if r.path.endswith("/adcreatives")]
+ assert len(edge_requests) == 3
+ assert edge_requests[2].qs["fields"] == ["id"]
+ assert edge_requests[2].qs["after"] == ["a"]
+
+
+def test_ad_creatives_object_story_spec_first_page_fails_no_next(api, some_config, requests_mock, account_id):
+ """When the very first page fails and the id page has no next, creatives are emitted and the stream ends."""
+ stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ base_url = f"{FacebookSession.GRAPH}/{FacebookAdsApi.API_VERSION}/"
+ creatives_url = f"{base_url}act_{account_id}/adcreatives"
+
+ failed_page = {"json": _object_story_spec_read_error(2446211), "status_code": 400}
+ id_page = {"json": {"data": [{"id": "c1"}, {"id": "c2"}]}, "status_code": 200}
+ requests_mock.register_uri("GET", creatives_url, [failed_page, id_page])
+ requests_mock.register_uri("GET", f"{base_url}c1/", json={"id": "c1"})
+ requests_mock.register_uri("GET", f"{base_url}c2/", json={"id": "c2"})
+
+ records = list(
+ stream.read_records(
+ sync_mode=SyncMode.full_refresh,
+ stream_state={},
+ stream_slice={"account_id": account_id},
+ )
+ )
+
+ assert [r["id"] for r in records] == ["c1", "c2"]
+
+
+def test_ad_creatives_pages_keep_cursor_patch_guards(api, some_config, requests_mock, account_id):
+ """ad_creatives pages are read through CursorPatch, so a malformed item in `data` is dropped instead of crashing the read."""
+ stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ creatives_url = f"{FacebookSession.GRAPH}/{FacebookAdsApi.API_VERSION}/act_{account_id}/adcreatives"
+ requests_mock.register_uri("GET", creatives_url, json={"data": ["unexpected", {"id": "c1"}]})
+
+ records = list(stream.read_records(sync_mode=SyncMode.full_refresh, stream_state={}, stream_slice={"account_id": account_id}))
+
+ assert [r["id"] for r in records] == ["c1"]
+
+
+def test_ad_creatives_empty_first_page_keeps_paging(api, some_config, requests_mock, account_id):
+ """Like get_ad_creatives(), an empty first page that still has a `next` link does not end the read."""
+ stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ creatives_url = f"{FacebookSession.GRAPH}/{FacebookAdsApi.API_VERSION}/act_{account_id}/adcreatives"
+ empty_page = {
+ "json": {"data": [], "paging": {"cursors": {"after": "A"}, "next": _graph_next_url(creatives_url, "A", ",".join(stream.fields()))}},
+ "status_code": 200,
+ }
+ requests_mock.register_uri("GET", creatives_url, [empty_page, {"json": {"data": [{"id": "c1"}]}, "status_code": 200}])
+
+ records = list(stream.read_records(sync_mode=SyncMode.full_refresh, stream_state={}, stream_slice={"account_id": account_id}))
+
+ assert [r["id"] for r in records] == ["c1"]
+
+
+@pytest.mark.parametrize(
+ "error_subcode, deselect_object_story_spec",
+ [(33, False), (2446211, True)],
+ ids=["unrelated_error", "object_story_spec_not_requested"],
+)
+def test_ad_creatives_page_error_without_reread(api, some_config, requests_mock, account_id, error_subcode, deselect_object_story_spec):
+ """A page error that dropping object_story_spec cannot fix fails the read as before, without re-reading the page."""
+ stream = AdCreatives(api=api, account_ids=some_config["account_ids"])
+ if deselect_object_story_spec:
+ stream.configured_json_schema = {"properties": {"id": {"type": ["null", "string"]}, "name": {"type": ["null", "string"]}}}
+ creatives_url = f"{FacebookSession.GRAPH}/{FacebookAdsApi.API_VERSION}/act_{account_id}/adcreatives"
+ requests_mock.register_uri("GET", creatives_url, json=_object_story_spec_read_error(error_subcode), status_code=400)
+
+ with pytest.raises(AirbyteTracedException):
+ list(stream.read_records(sync_mode=SyncMode.full_refresh, stream_state={}, stream_slice={"account_id": account_id}))
+
+ assert len([r for r in requests_mock.request_history if r.path.endswith("/adcreatives")]) == 1
diff --git a/docs/integrations/sources/facebook-marketing-migrations.md b/docs/integrations/sources/facebook-marketing-migrations.md
index d3979ce585cb..ec1ebe0486a9 100644
--- a/docs/integrations/sources/facebook-marketing-migrations.md
+++ b/docs/integrations/sources/facebook-marketing-migrations.md
@@ -1,5 +1,105 @@
# Facebook Marketing Migration Guide
+## Upgrading to 6.0.0
+
+Meta deprecated the `dma` (Nielsen DMA) breakdown effective June 22, 2026, replacing it with `comscore_market` (Comscore Markets). This is an out-of-cycle change that applies to all API versions immediately.
+
+### What changed
+
+Meta transitioned from Nielsen DMA to Comscore Markets for geographic ad-performance data. The following built-in streams have been replaced:
+
+| Removed Stream (v5.x) | Replacement Stream (v6.0.0) | Breakdown |
+| :--------------------- | :-------------------------- | :-------- |
+| `ads_insights_dma` | `ads_insights_comscore_market` | `comscore_market` |
+| `ads_insights_demographics_dma_region` | `ads_insights_demographics_comscore_market_region` | `comscore_market` |
+
+The `dma` breakdown has also been removed from the Custom Insights configuration options.
+
+### Who is affected?
+
+Any user syncing the `ads_insights_dma` or `ads_insights_demographics_dma_region` streams, or any Custom Insights stream configured with the `dma` breakdown.
+
+### Custom Insights streams
+
+If you have any **Custom Insights** streams that use `breakdowns=dma`, you must update them to use `comscore_market` before syncing:
+
+1. Go to **Sources** → select your Facebook Marketing source.
+2. In the **Custom Insights** section, find streams that include `dma` in their breakdowns.
+3. Replace `dma` with `comscore_market` in the breakdown list.
+4. Save and retest the source.
+
+:::note
+After upgrading to v6.0.0, syncs for Custom Insights streams that still reference `dma` will fail with a configuration error because `dma` is no longer a valid breakdown option. Update your configuration to use `comscore_market` instead.
+:::
+
+### Steps to upgrade built-in streams
+
+1. Select **Connections** in the main navbar.
+ 1. Select the connection(s) affected by the update.
+2. Select the **Schema** tab.
+ 1. Select **Refresh source schema**.
+ 2. Select **OK**.
+ :::note
+ Any detected schema changes will be listed for your review. The old DMA streams will be removed and the new Comscore Market streams will be available.
+ :::
+3. Enable the new `ads_insights_comscore_market` and/or `ads_insights_demographics_comscore_market_region` streams to replace the removed DMA streams.
+4. Select **Save changes** at the bottom of the page.
+ 1. Ensure the **Clear affected streams** option is checked.
+5. Select **Save connection**.
+ :::note
+ This will reset the data in your destination and initiate a fresh sync.
+ :::
+
+For more information on resetting your data in Airbyte, see [this page](/platform/operator-guides/clear).
+
+## Upgrading to 5.0.0
+
+This version includes three breaking schema changes:
+
+### 1. Level-based primary keys for Custom Insights
+
+Custom Insights streams now use level-based primary keys. Previously, all Custom Insights streams used `ad_id` as part of their primary key regardless of the configured `level` setting. This caused issues when using `level=adset`, `level=campaign`, or `level=account` because the `ad_id` field would be null, making deduplication impossible.
+
+With this update, the primary key now correctly reflects the configured level:
+
+| Level | Primary Key Fields |
+| :---- | :----------------- |
+| `ad` (default) | `date_start`, `account_id`, `ad_id`, plus any breakdowns |
+| `adset` | `date_start`, `account_id`, `adset_id`, plus any breakdowns |
+| `campaign` | `date_start`, `account_id`, `campaign_id`, plus any breakdowns |
+| `account` | `date_start`, `account_id`, plus any breakdowns |
+
+### 2. Removed deprecated attribution window columns
+
+The `7d_view` and `28d_view` columns have been removed from all Ads Insights streams. Meta deprecated these attribution windows on January 12, 2026, and they have been returning null values since that date. Only `1d_view` remains as a supported view-through attribution window. The click-through windows (`1d_click`, `7d_click`, `28d_click`) are unaffected.
+
+### 3. Removed `wish_bid` field
+
+The `wish_bid` field has been removed from Ads Insights streams. This field was already excluded from API requests because it caused data inaccuracies (incorrect `spend` values) and has been returning null.
+
+### Who is affected?
+
+All users syncing any Ads Insights stream (built-in or custom) are affected by the schema column removals (changes 2 and 3). Users that sync Custom Insights streams with `level=adset`, `level=campaign`, or `level=account` are additionally affected by the primary key change (change 1). Users syncing only default `level=ad` Custom Insights or only built-in Ads Insights streams only need to refresh their schema for the column removals.
+
+### Steps to upgrade
+
+1. Select **Connections** in the main navbar.
+ 1. Select the connection(s) affected by the update.
+2. Select the **Schema** tab.
+ 1. Select **Refresh source schema**.
+ 2. Select **OK**.
+ :::note
+ Any detected schema changes will be listed for your review.
+ :::
+3. Select **Save changes** at the bottom of the page.
+ 1. Ensure the **Clear affected streams** option is checked.
+4. Select **Save connection**.
+ :::note
+ This will reset the data in your destination and initiate a fresh sync.
+ :::
+
+For more information on resetting your data in Airbyte, see [this page](/platform/operator-guides/clear).
+
## Upgrading to 4.0.0
The connector has been updated to use [v23.0 of Meta's Marketing API](https://developers.facebook.com/docs/marketing-api/marketing-api-changelog/version23.0) as v21.0 will be deprecated on September 9, 2025.
diff --git a/docs/integrations/sources/facebook-marketing.md b/docs/integrations/sources/facebook-marketing.md
index a4bd1fa589f7..514906a6860f 100644
--- a/docs/integrations/sources/facebook-marketing.md
+++ b/docs/integrations/sources/facebook-marketing.md
@@ -8,15 +8,11 @@ This page contains the setup guide and reference information for the [Facebook M
## Prerequisites
-- A [Facebook Ad Account ID](https://www.facebook.com/business/help/1492627900875762)
-
-- **For Airbyte Cloud**: If you are not the owner/admin of the Ad account, you must be granted [permissions to access the Ad account](https://www.facebook.com/business/help/155909647811305?id=829106167281625) by an admin.
-
-
-- **For Airbyte Open Source**:
- - [Facebook app](https://developers.facebook.com/apps/) with the Marketing API enabled
- - The following permissions: [ads_management](https://developers.facebook.com/docs/permissions#a), [ads_read](https://developers.facebook.com/docs/permissions#a), [business_management](https://developers.facebook.com/docs/permissions#b) and [read_insights](https://developers.facebook.com/docs/permissions#r).
-
+- A [Facebook Ad Account ID](https://www.facebook.com/business/help/1492627900875762) for each ad account you want to sync.
+- Access to each of those ad accounts. If you aren't an admin of an ad account, an admin must [grant you access to it](https://www.facebook.com/business/help/155909647811305?id=829106167281625). If you authenticate with a system user access token, the ad accounts must be assigned to that system user.
+- **To authenticate with an access token** (required for Airbyte Open Source, optional for Airbyte Cloud):
+ - A [Meta app](https://developers.facebook.com/apps/) created with the **Measure ad performance data with Marketing API** use case and connected to a business portfolio.
+ - A system user access token with the `ads_read`, `ads_management`, and `business_management` permissions. See [Create a Meta app and access token](#create-a-meta-app-and-access-token).
## Setup guide
@@ -29,7 +25,14 @@ This page contains the setup guide and reference information for the [Facebook M
2. Click Sources and then click + New source.
3. On the Set up the source page, select Facebook Marketing from the Source type dropdown.
4. Enter a name for the Facebook Marketing connector.
-5. To authenticate the connection, click **Authenticate your account** to authorize your Facebook account. Ensure you are logged into the right account, as Airbyte will authenticate the account you are currently logged in to.
+
+
+
+5. For **Authentication**, choose one of these options:
+ - **Authenticate via Facebook Marketing (Oauth)**: Click **Authenticate your account** to authorize your Facebook account. Make sure you're logged into the right Facebook account, because Airbyte authenticates the account you're currently logged in to. That account must have access to the ad accounts you want to sync.
+ - **Service Account Key Authentication**: Enter a system user access token. To create one, follow the steps in [Create a Meta app and access token](#create-a-meta-app-and-access-token).
+
+
@@ -39,242 +42,260 @@ This page contains the setup guide and reference information for the [Facebook M
2. Click Sources and then click + New source.
3. On the Set up the source page, select Facebook Marketing from the Source type dropdown.
4. Enter a name for the Facebook Marketing connector.
-
-5. In the **Access Token** field, enter the Marketing API access token.
-
-
-### Airbyte Open Source
-
-This guide outlines the steps required to configure your Meta Developer account and create an app to utilize the Facebook Marketing API.
-
-Follow these five key steps:
-
-1. **Register as a Meta Developer:** If you haven't already, create your developer account.
-2. **Create a New App:** Set up a new application within your Developer Dashboard.
-3. **Integrate the Marketing API:** Add the Marketing API product to your newly created app.
-4. **Generate an Access Token:** Obtain the necessary credentials to authenticate your API requests.
-5. **Request Increased Rate Limits:** Ensure your app can handle the required data volume by requesting Advanced Access.
-
-### 1. Register as a Meta Developer
-A Meta Developer account is your gateway to the App Dashboard, SDKs, APIs, development tools, and documentation.
+
-To register, follow the official instructions: 🔗 [Register as a Meta Developer](https://developers.facebook.com/docs/development/register/)
+5. For **Authentication**, select **Service Account Key Authentication** and enter a system user access token. To create one, follow the steps in [Create a Meta app and access token](#create-a-meta-app-and-access-token).
-### 2. Create a New App
-
-Your Meta app serves as a container for your API credentials and permissions. Meta uses it to monitor API usage, enforce rate limits, and ensure application security.
-
-- Go to the 🔗 [Meta for Developers App Dashboard](https://developers.facebook.com/apps/) and click **Create App**.
-
-- **Important:**
- During the setup process, at the **"Use case"** step, select:
- > **Create an app without a use case**
- > *Choose this option if you'd like to get an app ID without automatically adding any permissions, features, or products.*
-
-- **App Type:**
- Choose **Business** as the app type when prompted.
+
+
-### 3. Add the Marketing API Product
+### Create a Meta app and access token
-After creating your app, you’ll need to enable the Marketing API to begin making requests.
+Follow these steps to create a Meta app and a system user access token for **Service Account Key Authentication**. Meta's UI labels change from time to time. If a label below doesn't match what you see, refer to the linked Meta documentation.
-- In your app’s dashboard, open the sidebar menu.
-- Click **Add Product**.
-- Find and select **Marketing API** from the list of available products.
+#### Step 1: Register as a Meta developer
-📚 **Further Reading:** For an overview of the Marketing API, see: [Facebook Developer Marketing API Docs](https://developers.facebook.com/docs/marketing-apis)
+If you don't have one yet, [register as a Meta developer](https://developers.facebook.com/docs/development/register/). A developer account gives you access to the App Dashboard.
+#### Step 2: Create a Meta app
-### 4. Generate an Access Token
+1. Go to the [Meta for Developers App Dashboard](https://developers.facebook.com/apps/) and click **Create App**.
+2. When asked to add a use case, select **Measure ad performance data with Marketing API**. This use case adds the `ads_read`, `ads_management`, and `business_management` permissions and the **Marketing API Access Tier** feature to your app. Don't choose **Create an app without a use case**, because that option creates an app without any permissions or products.
+3. Connect the app to the business portfolio that owns, or has access to, your ad accounts. Meta recommends a verified business portfolio, and you need one to access ad accounts owned by other businesses.
+4. Finish creating the app.
-To authorize your application to interact with the Facebook Marketing API, you'll need to generate an access token with the appropriate permissions.
+For more information, see Meta's [Create an app](https://developers.facebook.com/documentation/development/create-an-app) and [Marketing API: Get started](https://developers.facebook.com/documentation/ads-commerce/marketing-api/get-started) guides.
-- From your app's dashboard, go to **Marketing API > Tools**.
+#### Step 3: Generate a system user access token
-- In the **Token Permissions** section, select the following permissions:
- - `ads_management`: Manage ads and campaigns.
- - `ads_read`: Read ad and campaign data.
- - `read_insights`: Access insights data for ads, ad sets, and campaigns.
- - `business_management`: Manage business assets (often required to access ad accounts connected to a Meta Business Manager).
+A [system user](https://developers.facebook.com/docs/business-management-apis/system-users/overview) is a non-human account in your business portfolio. Its access token isn't tied to a personal Facebook login, which makes it the recommended option for server-to-server integrations like Airbyte.
-- Click **Get Token** to generate the access token.
+1. In [Meta Business Settings](https://business.facebook.com/settings), go to **Users** > **System users** and click **Add** to create a system user. See Meta's [Add system users to your business portfolio](https://www.facebook.com/business/help/503306463479099) guide.
+2. Select the system user and click **Assign assets**. Assign every ad account you want to sync, with at least permission to view performance. Also assign the Meta app you created in Step 2.
+3. Click **Generate new token** and select your app.
+4. Choose an expiration. A token that expires after 60 days is more secure, but you must generate a new one and update it in Airbyte before it expires. A token that never expires doesn't need to be refreshed.
+5. Select the `ads_read`, `ads_management`, and `business_management` permissions, then generate the token.
+6. Copy the token and store it securely. Enter it as the **Access Token** when you choose **Service Account Key Authentication**.
-- **Copy the generated token securely.**
- Use this Access Token to authenticate your API calls when using the “Service Account Key Authentication” method.
+The system user and the app must belong to the same business portfolio. For details, see Meta's [Install apps and generate tokens](https://developers.facebook.com/docs/business-management-apis/system-users/install-apps-and-generate-tokens) guide.
:::tip
-You can always view your existing access tokens, their permissions, and lifecycles using the 🔗 [Access Token Tool](https://developers.facebook.com/tools/accesstoken).
+You can check a token's permissions and expiration with Meta's [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/).
:::
-### 5. Request Increased Rate Limits
-
-By default, API tokens generated from apps with "Standard Access" are heavily throttled by Facebook.
+#### Step 4: Upgrade to the Marketing API Access Tier's full access
-This can make them unsuitable for applications requiring frequent or large data syncs (like with Airbyte).
+New apps start with **Limited access** to the Marketing API. Limited access is heavily rate-limited and meant for development only, so it's usually too slow for regular syncs.
-To ensure reliable performance, you'll need to request "Advanced Access."
+1. In the App Dashboard, find the **Marketing API Access Tier** feature that the use case added to your app.
+2. Click **+Upgrade** to request **Full access**.
-- **Access App Review**
- - From your app's dashboard, go to **App Review > Permissions and Features**.
+To qualify for and keep full access, your app must have made at least 500 Marketing API calls in the past 15 days, with an error rate below 15% over its last 500 calls. Meta evaluates these requirements continuously, so it can move an app back to limited access.
-- **Identify Required Permissions**
- - For each of the following permissions marked as "Standard Access", click the **Request advanced access** button:
- - `ads_read`
- - `ads_management`
- - Facebook may prompt you to fill out a form detailing how the permission is used.
+You only need advanced access to the `ads_read` or `ads_management` permissions, which requires App Review and business verification, if you sync ad accounts owned by other businesses. For details, see Meta's [Marketing API: Authorization](https://developers.facebook.com/documentation/ads-commerce/marketing-api/get-started/authorization) guide.
-- **Complete Business Verification**
- - Make sure your app is associated with a **verified Business Manager account**.
- - This is a [prerequisite](https://developers.facebook.com/docs/marketing-api/get-started/authorization/#business-verification) for obtaining Advanced Access.
+### Permission errors
-- **Submit the App Review Request**
- - Once all information is provided, submit the request through the App Review interface.
- - Monitor the status in the dashboard as Facebook reviews your application.
+If the connection check or a sync fails with a permission error for an ad account, check the following:
-- **Meet Rate Limit Requirements**
- - Once you’ve been granted advanced access, you must consistently make at least 1,500 Marketing API calls within any rolling 15-day window to [maintain your status](https://developers.facebook.com/docs/marketing-api/get-started/authorization/#permissions-and-features).
- - Facebook continuously evaluates your API activity based on the past 15 days, not just immediately after approval.
- - Falling below the 1,500 call threshold during any 15-day period may result in your advanced access being revoked.
+- **The Account ID is correct.** Enter only the number, without the `act_` prefix.
+- **The authenticated user has access to the ad account.** With OAuth, Airbyte uses the Facebook account you were logged in to when you clicked **Authenticate your account**. With an access token, the ad account must be assigned to the system user. You can check who has access in [Meta Business Settings](https://business.facebook.com/settings) under **Accounts** > **Ad accounts**.
+- **The token has the required permissions.** Use the [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/) to confirm that the token includes `ads_read`, `ads_management`, and `business_management`, and that it hasn't expired.
+- **The ad account belongs to your business portfolio, or is shared with it.** If another business owns the ad account, that business must share it with your business portfolio.
+### Facebook Marketing source settings
-📚 **Guidance:** Refer to Facebook's official documentation on [Access Levels and Authorization](https://developers.facebook.com/docs/marketing-api/get-started/authorization/) for detailed instructions on requesting Advanced Access.
+
-
+1. For **Account ID(s)**, enter one or more comma-separated [Facebook Ad Account ID numbers](https://www.facebook.com/business/help/1492627900875762). To find an ID, open [Meta Ads Manager](https://adsmanager.facebook.com/), go to your ad account's **Settings**, and look under **Account overview**. Enter only the number, without the `act_` prefix.
-#### Facebook Marketing Source Settings
-
-1. For **Account ID(s)**, enter one or multiple comma-separated [Facebook Ad Account ID Numbers](https://www.facebook.com/business/help/1492627900875762) to use when pulling data from the Facebook Marketing API. To find this ID, open your Meta Ads Manager. The Ad Account ID number is in the **Account** dropdown menu or in your browser's address bar. Refer to the [Facebook docs](https://www.facebook.com/business/help/1492627900875762) for more information.
-2. (Optional) For **Start Date**, use the provided datepicker, or enter the date programmatically in the `YYYY-MM-DDTHH:mm:ssZ` format. If the start date is not set, then all data will be replicated except for `Insight` data, which only pulls data for the last 37 months.
- :::info
- Insight tables are only able to pull data from the last 37 months. If you are syncing insight tables and your start date is older than 37 months, your sync will not succeed for those streams.
- :::
+2. (Optional) For **Start Date**, use the provided datepicker, or enter the date programmatically in the `YYYY-MM-DDTHH:mm:ssZ` format. If you don't set a start date, the connector replicates all data, except for Insights data, which it only pulls for the last 37 months.
+
+:::info
+Insight tables can only pull data from the last 37 months. If you're syncing insight tables and your start date is older than 37 months, your sync won't succeed for those streams.
+:::
+
3. (Optional) For **End Date**, use the provided datepicker, or enter the date programmatically in the `YYYY-MM-DDTHH:mm:ssZ` format. This is the date until which you'd like to replicate data for all Incremental streams. All data generated between the start date and this end date will be replicated. Not setting this option will result in always syncing the latest data.
+
+
4. (Optional) Multiselect the **Campaign Statuses** to include data from Campaigns for particular statuses.
+
+
5. (Optional) Multiselect the **AdSet Statuses** to include data from AdSets for particular statuses.
+
+
6. (Optional) Multiselect the **Ad Statuses** to include data from Ads for particular statuses.
+
- :::caution Status filtering and missing records
- When no statuses are selected for Campaign Statuses, AdSet Statuses, or Ad Statuses, the connector relies on the Facebook Marketing API's default behavior, which **excludes records in ARCHIVED and DELETED states**. This means archived campaigns, ad sets, and ads will not appear in your synced data.
+:::caution
+**Status filtering and missing records**
- To ensure a complete dataset, explicitly select all statuses you want to include. This is especially important when using Full Refresh sync mode, because previously synced records that have since been archived will not be re-fetched unless you include the ARCHIVED status.
- :::
+When no statuses are selected for Campaign Statuses, AdSet Statuses, or Ad Statuses, the connector relies on the Facebook Marketing API's default behavior, which **excludes records in ARCHIVED and DELETED states**. This means archived campaigns, ad sets, and ads will not appear in your synced data.
+
+To ensure a complete dataset, explicitly select all statuses you want to include. This is especially important when using Full Refresh sync mode, because previously synced records that have since been archived will not be re-fetched unless you include the ARCHIVED status.
+:::
+
7. (Optional) Toggle the **Fetch Thumbnail Images** button to fetch the `thumbnail_url` and store the result in `thumbnail_data_url` for each [Ad Creative](https://developers.facebook.com/docs/marketing-api/creative/).
+
+
8. (Optional) If needed, you can change default action breakdowns for Built-in Ads Insights stream. Remove all if you need to make it empty list or change default values.
+
-9. (Optional) In the **Custom Insights** section, you may provide a list of ad statistics entries. Each entry should have a unique name and can contain fields, breakdowns or action_breakdowns. Fields refer to the different data points you can collect from an ad, while breakdowns and action_breakdowns let you segment this data for more detailed insights. Click on **Add** to create a new entry in this list.
+
+9. (Optional) In the **Custom Insights** section, you may provide a list of ad statistics entries. Each entry should have a unique name and can contain fields, breakdowns, or action breakdowns (`action_breakdowns`). Fields refer to the different data points you can collect from an ad, while breakdowns and action breakdowns let you segment this data for more detailed insights. Click **Add** to create a new entry in this list. See [Custom Insights settings](#custom-insights-settings) for each entry's options.
To retrieve specific fields from Facebook Ads Insights combined with other breakdowns, you can choose which fields and breakdowns to sync. However, please note that not all fields can be requested, and many are only functional when combined with specific other fields. For example, the breakdown `app_id` is only supported with the `total_postbacks` field. For more information on the breakdown limitations, refer to the [Facebook documentation](https://developers.facebook.com/docs/marketing-api/insights/breakdowns).
- :::info
- Additional data streams for your Facebook Marketing connector are dynamically generated according to the Custom Insights you specify. If you have an existing Facebook Marketing source and you decide to update or remove some of your Custom Insights, you must also update the connections to sync these streams by refreshing the schema.
- :::
+:::info
+Additional data streams for your Facebook Marketing connector are dynamically generated according to the Custom Insights you specify. If you have an existing Facebook Marketing source and you decide to update or remove some of your Custom Insights, you must also update the connections to sync these streams by refreshing the schema.
+:::
+
- To configure Custom Insights:
+Optionally, configure each custom insight's [Custom Insights settings](#custom-insights-settings) and the [Advanced settings](#advanced-settings). Then click **Set up source** and wait for the tests to complete.
+
+#### Custom Insights settings
+
+To define the data each custom insight pulls:
+
- 1. For **Name**, enter a name for the insight. This will be used as the Airbyte stream name.
+
+1. For **Name**, enter a name for the insight. This will be used as the Airbyte stream name.
+
- 2. (Optional) For **Level**, enter the level of granularity for the data you want to pull from the Facebook Marketing API (`account`, `ad`, `adset`, `campaign`). Set to `ad` by default. The level you select determines the primary key used for deduplication in Incremental Append + Deduped sync mode. For details, see the [primary key behavior by level](#custom-insights-primary-keys) section.
+
+2. (Optional) For **Level**, enter the level of granularity for the data you want to pull from the Facebook Marketing API (`account`, `ad`, `adset`, `campaign`). Set to `ad` by default. The level you select determines the primary key used for deduplication in Incremental Append + Deduped sync mode. For details, see the [primary key behavior by level](#custom-insights-primary-keys) section.
+
- 3. (Optional) For **Fields**, use the dropdown list to select the fields you want to pull from the Facebook Marketing API.
+
+3. (Optional) For **Fields**, use the dropdown list to select the fields you want to pull from the Facebook Marketing API.
+
- 4. (Optional) For **Breakdowns**, use the dropdown list to select the breakdowns you want to configure.
- :::info High-cardinality breakdowns
- Some breakdowns, such as `product_id`, can produce thousands of rows per day. Connection setup still succeeds for these breakdowns: if Facebook's synchronous validation call returns `"Please reduce the amount of data you're asking for"`, the connector retries with a one-day window to validate the breakdown combination, and falls back to a logged warning if the single-day call also exceeds the limit. Real syncs use async jobs and are not affected by this limit.
- :::
+4. (Optional) For **Breakdowns**, use the dropdown list to select the breakdowns you want to configure.
+
+:::info
+**High-cardinality breakdowns**
+
+Some breakdowns, such as `product_id`, can produce thousands of rows per day. Connection setup still succeeds for these breakdowns: if Facebook's synchronous validation call returns `"Please reduce the amount of data you're asking for"`, the connector retries with a one-day window to validate the breakdown combination, and falls back to a logged warning if the single-day call also exceeds the limit. Real syncs use async jobs and are not affected by this limit.
+:::
+
- 5. (Optional) For **Action Breakdowns**, use the dropdown list to select the action breakdowns you want to configure.
+
+5. (Optional) For **Action Breakdowns**, use the dropdown list to select the action breakdowns you want to configure.
+
- 6. (Optional) For **Action Report Time**, enter the action report time you want to configure. This value determines the timing used to report action statistics. For example, if a user sees an ad on Jan 1st but converts on Jan 2nd, this value will determine how the action is reported.
- - `impression`: Actions are attributed to the time the ad was viewed (Jan 1st).
- - `conversion`: Actions are attributed to the time the action was taken (Jan 2nd).
- - `mixed`: Click-through actions are attributed to the time the ad was viewed (Jan 1st), and view-through actions are attributed to the time the action was taken (Jan 2nd).
+6. **Action Report Time** is deprecated and hidden from the UI since v3.5.0. It defaults to `mixed` and cannot be changed through the Airbyte UI. If you set it programmatically (via API, Terraform, or PyAirbyte), the available values are `impression` (attributed to view time), `conversion` (attributed to action time), or `mixed` (click-through to view time, view-through to action time).
+
+To set the time range and attribution window for each custom insight:
+
- 7. (Optional) For **Time Increment**, you may provide a value in days by which to aggregate statistics. The sync will be chunked into intervals of this size. For example, if you set this value to 7, the sync will be chunked into 7-day intervals. The default value is 1 day. Cannot be used together with **Time Increment Period**.
+
+1. (Optional) For **Time Increment**, you may provide a value in days by which to aggregate statistics. The sync will be chunked into intervals of this size. For example, if you set this value to 7, the sync will be chunked into 7-day intervals. The default value is 1 day. Cannot be used together with **Time Increment Period**.
+
- 8. (Optional) For **Time Increment Period**, select a calendar-aligned aggregation period instead of a fixed number of days. This produces consistently aligned time buckets regardless of the start date, making cross-client comparison easier. Available options:
- - `daily` — equivalent to Time Increment = 1 (1-day buckets).
- - `weekly` — aligns to Monday-through-Sunday calendar weeks.
- - `monthly` — aligns to calendar month boundaries (1st to last day of each month). This is natively supported by the Facebook API.
+
+2. (Optional) For **Time Increment Period**, select a calendar-aligned aggregation period instead of a fixed number of days. This produces consistently aligned time buckets regardless of the start date, making cross-client comparison easier. Available options:
+ - `daily` — equivalent to Time Increment = 1 (1-day buckets).
+ - `weekly` — aligns to Monday-through-Sunday calendar weeks.
+ - `monthly` — aligns to calendar month boundaries (1st to last day of each month). This is natively supported by the Facebook API.
Cannot be used together with **Time Increment**. When switching between Time Increment and Time Increment Period (or vice versa), a full re-sync will be triggered.
+
- 9. (Optional) For **Start Date**, enter the date in the `YYYY-MM-DDTHH:mm:ssZ` format. The data added on and after this date will be replicated. If this field is left blank, Airbyte will replicate all data.
+
+3. (Optional) For **Start Date**, enter the date in the `YYYY-MM-DDTHH:mm:ssZ` format. The data added on and after this date will be replicated. If this field is left blank, Airbyte will replicate all data.
+
- 10. (Optional) For **End Date**, enter the date in the `YYYY-MM-DDTHH:mm:ssZ` format. The data added on and before this date will be replicated. If this field is left blank, Airbyte will replicate the latest data.
+
+4. (Optional) For **End Date**, enter the date in the `YYYY-MM-DDTHH:mm:ssZ` format. The data added on and before this date will be replicated. If this field is left blank, Airbyte will replicate the latest data.
+
- 11. (Optional) For **Custom Insights Lookback Window**, you may set a window in days to revisit data during syncing to capture updated conversion data from the API. Facebook allows for click-through attribution windows of up to 28 days, during which time a conversion can be attributed to an ad. View-through attribution is limited to 1 day. If you have set a custom attribution window in your Facebook account, please set the same value here. Otherwise, you may leave it at the default value of 28. For more information on action attributions, please refer to [the Meta Help Center](https://www.facebook.com/business/help/458681590974355?id=768381033531365).
+
+5. (Optional) For **Custom Insights Lookback Window**, you may set a window in days to revisit data during syncing to capture updated conversion data from the API. Facebook allows for click-through attribution windows of up to 28 days, during which time a conversion can be attributed to an ad. View-through attribution is limited to 1 day. If you have set a custom attribution window in your Facebook account, please set the same value here. Otherwise, you may leave it at the default value of 28 days. For more information on action attributions, please refer to [the Meta Help Center](https://www.facebook.com/business/help/458681590974355?id=768381033531365).
+
- 12. (Optional) Toggle **Include Incrementality** to add the `incrementality` attribution window to this custom insight stream. When enabled, action metrics such as `actions`, `action_values`, and `cost_per_action_type` include an `incrementality` field. This setting applies only to this specific custom insight. For more details, see the global **Include Incrementality** setting described below.
+
+6. (Optional) Toggle **Include Incrementality** to add the `incrementality` attribution window to this custom insight stream. When enabled, action metrics such as `actions`, `action_values`, and `cost_per_action_type` include an `incrementality` field. This setting applies only to this specific custom insight. For more details, see the global **Include Incrementality** setting in [Advanced settings](#advanced-settings).
+
+#### Advanced settings
+
+Most users don't need to change these settings.
+
-10. (Optional) For **Page Size of Requests**, you can specify the number of records per page for paginated responses. Most users do not need to set this field unless specific issues arise or there are unique use cases that require tuning the connector's settings. The default value is set to retrieve 100 records per page.
+
+1. (Optional) For **Page Size of Requests**, you can specify the number of records per page for paginated responses. Most users do not need to set this field unless specific issues arise or there are unique use cases that require tuning the connector's settings. The default value is set to retrieve 100 records per page.
+
-11. (Optional) For **Insights Window Lookback**, you may set a window in days to revisit data during syncing to capture updated conversion data from the API. Facebook allows for click-through attribution windows of up to 28 days, during which time a conversion can be attributed to an ad. View-through attribution is limited to 1 day. If you have set a custom attribution window in your Facebook account, please set the same value here. Otherwise, you may leave it at the default value of 28. For more information on action attributions, please refer to [the Meta Help Center](https://www.facebook.com/business/help/458681590974355?id=768381033531365).
+
+2. (Optional) For **Insights Window Lookback**, you may set a window in days to revisit data during syncing to capture updated conversion data from the API. Facebook allows for click-through attribution windows of up to 28 days, during which time a conversion can be attributed to an ad. View-through attribution is limited to 1 day. If you have set a custom attribution window in your Facebook account, please set the same value here. Otherwise, you may leave it at the default value of 28 days. For more information on action attributions, please refer to [the Meta Help Center](https://www.facebook.com/business/help/458681590974355?id=768381033531365).
+
-12. (Optional) For **Insights Job Timeout**, you may set a custom value in range from 10 to 60. It establishes the maximum amount of time (in minutes) of waiting for the report job to complete.
+
+3. (Optional) For **Insights Job Timeout**, you may set a custom value in range from 10 to 60 minutes. It establishes the maximum amount of time of waiting for the report job to complete.
+
-13. (Optional) Toggle **Include Incrementality** to add the `incrementality` attribution window to all built-in Ads Insights streams. When enabled, the connector appends `"incrementality"` to the `action_attribution_windows` parameter sent to the Facebook API. Action metrics such as `actions`, `action_values`, and `cost_per_action_type` then include an `incrementality` field containing the incremental lift value attributed to the ad. This field is only populated for ad accounts that have active [Conversion Lift](https://developers.facebook.com/docs/marketing-api/guides/lift-studies/) studies configured in Facebook. For accounts without lift studies, the field is `null`. Disabled by default. For more details on the `incrementality` attribution window, refer to the [Ads Action Stats](https://developers.facebook.com/docs/marketing-api/reference/ads-action-stats/) API reference.
-
-14. Click **Set up source** and wait for the tests to complete.
+4. (Optional) Toggle **Include Incrementality** to add the `incrementality` attribution window to all built-in Ads Insights streams. When enabled, the connector appends `"incrementality"` to the `action_attribution_windows` parameter sent to the Facebook API. Action metrics such as `actions`, `action_values`, and `cost_per_action_type` then include an `incrementality` field containing the incremental lift value attributed to the ad. This field is only populated for ad accounts that have active [Conversion Lift](https://developers.facebook.com/docs/marketing-api/guides/lift-studies/) studies configured in Facebook. For accounts without lift studies, the field is `null`. Disabled by default. For more details on the `incrementality` attribution window, refer to the [Ads Action Stats](https://developers.facebook.com/docs/marketing-api/reference/ads-action-stats/) API reference.
+
+
@@ -284,8 +305,8 @@ The Facebook Marketing source connector supports the following [sync modes](http
- [Full Refresh - Overwrite](https://docs.airbyte.com/understanding-airbyte/connections/full-refresh-overwrite/)
- [Full Refresh - Append](https://docs.airbyte.com/understanding-airbyte/connections/full-refresh-append)
-- [Incremental Sync - Append](https://docs.airbyte.com/understanding-airbyte/connections/incremental-append) (except for the AdCreatives, AdCreativesFromAds, AdAccount, CustomConversions, and CustomAudiences streams)
-- [Incremental Sync - Append + Deduped](https://docs.airbyte.com/understanding-airbyte/connections/incremental-append-deduped) (except for the AdCreatives, AdCreativesFromAds, AdAccount, CustomConversions, and CustomAudiences streams)
+- [Incremental Sync - Append](https://docs.airbyte.com/understanding-airbyte/connections/incremental-append) (except for the AdCreatives, AdAccount, CustomConversions, and CustomAudiences streams)
+- [Incremental Sync - Append + Deduped](https://docs.airbyte.com/understanding-airbyte/connections/incremental-append-deduped) (except for the AdCreatives, AdAccount, CustomConversions, and CustomAudiences streams)
## Supported Streams
@@ -294,10 +315,10 @@ The Facebook Marketing source connector supports the following [sync modes](http
| activities | [Latest](https://developers.facebook.com/docs/marketing-api/reference/ad-activity) | ✅ | ✅ |
| ad_account | [Latest](https://developers.facebook.com/docs/marketing-api/business-asset-management/guides/ad-accounts) | ✅ | ❌ |
| ad_creatives | [Latest](https://developers.facebook.com/docs/marketing-api/reference/ad-creative#fields) | ✅ | ❌ |
-| ad_creatives_from_ads | [Latest](https://developers.facebook.com/docs/marketing-api/reference/ad-creative#fields) | ✅ | ❌ |
+| ad_creatives_from_ads | [Latest](https://developers.facebook.com/docs/marketing-api/reference/ad-creative#fields) | ✅ | ✅ |
| ad_sets | [Latest](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign#fields) | ✅ | ✅ |
| ads | [Latest](https://developers.facebook.com/docs/marketing-api/reference/adgroup#fields) | ✅ | ✅ |
-| ads_insights | [Latest](https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/) | ✅ | ✅ |
+| ads_insights | [Latest](https://developers.facebook.com/docs/marketing-api/insights/) | ✅ | ✅ |
| campaigns | [Latest](https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group#fields) | ✅ | ✅ |
| custom_conversions | [Latest](https://developers.facebook.com/docs/marketing-api/reference/custom-conversion) | ✅ | ❌ |
| custom_audiences | [Latest](https://developers.facebook.com/docs/marketing-api/reference/custom-audience) | ✅ | ❌ |
@@ -311,7 +332,9 @@ The `rule` field in the `Custom Audiences` stream may not be synced for all reco
:::
:::info Ad Creatives From Ads
-The `ad_creatives_from_ads` stream is an alternative to `ad_creatives` that fetches creative data through the Ads endpoint instead of the AdCreatives endpoint. Use this stream if `ad_creatives` fails with the error "Please reduce the amount of data you're asking for." The output schema is identical to `ad_creatives`, but this stream only returns creatives associated with ads — orphaned creatives not linked to any ad are excluded. For more details, see the [Troubleshooting](#please-reduce-the-amount-of-data-error-on-the-ad-creatives-stream) section.
+The `ad_creatives_from_ads` stream is an alternative to `ad_creatives` that fetches creative data through the Ads endpoint instead of the AdCreatives endpoint. Use this stream if `ad_creatives` fails with the error "Please reduce the amount of data you're asking for." The output schema matches `ad_creatives` with one addition - an `updated_time` field carrying the parent ad's timestamp - but this stream only returns creatives associated with ads; orphaned creatives not linked to any ad are excluded. For more details, see the [Troubleshooting](#please-reduce-the-amount-of-data-error-on-the-ad-creatives-stream) section.
+
+When using incremental sync, the cursor is the parent ad's `updated_time` because AdCreative does not expose a timestamp of its own. Content changes always create a new creative and are picked up, but in-place renames, status or ad-label changes on a creative, and edits to the page post behind `effective_object_story_id` may not move the parent ad's timestamp and can be missed; use full refresh to capture those changes. The first incremental sync always reads the full ads history to seed the cursor (the `start_date` setting is not applied to this stream), so the time savings begin with the second sync.
:::
Airbyte also supports the following Prebuilt Facebook Ad Insights Reports:
@@ -331,22 +354,26 @@ Airbyte also supports the following Prebuilt Facebook Ad Insights Reports:
| Ad Insights Delivery Platform And Device Platform | `publisher_platform`, `device_platform` | `action_type` |
| Ad Insights Demographics Age | `age` | `action_type` |
| Ad Insights Demographics Country | `country` | `action_type` |
-| Ad Insights Demographics DMA Region | `dma` | `action_type` |
+| Ad Insights Demographics Comscore Market Region | `comscore_market` | `action_type` |
| Ad Insights Demographics Gender | `gender` | `action_type` |
-| Ad Insights DMA | `dma` | `action_type`, `action_target_id`, `action_destination` |
+| Ad Insights Comscore Market | `comscore_market` | `action_type`, `action_target_id`, `action_destination` |
| Ad Insights Country | `country` | `action_type`, `action_target_id`, `action_destination` |
| Ad Insights Platform And Device | `publisher_platform`, `platform_position`, `impression_device` | `action_type` |
| Ad Insights Region | `region` | `action_type`, `action_target_id`, `action_destination` |
+:::info Breakdown opt-in requirement (effective August 6, 2026)
+Beginning August 6, 2026, Meta requires certain ad accounts to opt in to the `impression_device`, `hourly_stats_aggregated_by_audience_time_zone`, and `frequency_value` breakdowns. This affects the `Ad Insights Platform And Device` stream and any Custom Insights stream configured with these breakdowns. The requirement applies to non-sales-supported accounts only. The connector retrieves insights through asynchronous report jobs, which Meta documents as a supported fallback, but if these streams return no data, ask your account administrator to opt in to the breakdown through Ads Manager. See [Meta's 2026 out-of-cycle changes](https://developers.facebook.com/docs/marketing-api/out-of-cycle-changes/occ-2026) for details.
+:::
+
You can segment the Ad Insights table into parts based on the following information. Each part will be synced as a separate table if normalization is enabled:
- Country
-- DMA (Designated Market Area)
+- Comscore Market
- Gender & Age
- Platform & Device
- Region
-For more information, see the [Facebook Insights API documentation.](https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/)
+For more information, see the [Facebook Insights API documentation.](https://developers.facebook.com/docs/marketing-api/insights/)