findly.unified-reporting-sdk 0.7.10__py3-none-any.whl → 0.7.11__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- findly/unified_reporting_sdk/data_sources/ga4/ga4_client.py +55 -16
- {findly_unified_reporting_sdk-0.7.10.dist-info → findly_unified_reporting_sdk-0.7.11.dist-info}/METADATA +1 -1
- {findly_unified_reporting_sdk-0.7.10.dist-info → findly_unified_reporting_sdk-0.7.11.dist-info}/RECORD +5 -5
- {findly_unified_reporting_sdk-0.7.10.dist-info → findly_unified_reporting_sdk-0.7.11.dist-info}/LICENSE +0 -0
- {findly_unified_reporting_sdk-0.7.10.dist-info → findly_unified_reporting_sdk-0.7.11.dist-info}/WHEEL +0 -0
|
@@ -240,6 +240,18 @@ class GA4Client(ReportsClient):
|
|
|
240
240
|
)
|
|
241
241
|
return None
|
|
242
242
|
|
|
243
|
+
def _deduplicate_dimensions(self, dimensions: List[Dimension]) -> List[Dimension]:
|
|
244
|
+
"""
|
|
245
|
+
Deduplicate a list of Dimension objects using their name as a unique key.
|
|
246
|
+
"""
|
|
247
|
+
seen = set()
|
|
248
|
+
deduped = []
|
|
249
|
+
for d in dimensions:
|
|
250
|
+
if d.name not in seen:
|
|
251
|
+
seen.add(d.name)
|
|
252
|
+
deduped.append(d)
|
|
253
|
+
return deduped
|
|
254
|
+
|
|
243
255
|
@backoff.on_exception(
|
|
244
256
|
backoff.expo, Exception, max_time=60, max_tries=3, giveup=give_up
|
|
245
257
|
)
|
|
@@ -260,10 +272,11 @@ class GA4Client(ReportsClient):
|
|
|
260
272
|
) -> Optional[RunReportResponse]:
|
|
261
273
|
report_response = None
|
|
262
274
|
try:
|
|
275
|
+
deduplicated_dimensions = self._deduplicate_dimensions(dimensions)
|
|
263
276
|
request = RunReportRequest(
|
|
264
277
|
property=f"properties/{property_id}",
|
|
265
278
|
date_ranges=date_ranges,
|
|
266
|
-
dimensions=
|
|
279
|
+
dimensions=deduplicated_dimensions,
|
|
267
280
|
metrics=metrics,
|
|
268
281
|
metric_filter=metric_filter,
|
|
269
282
|
dimension_filter=dimension_filter,
|
|
@@ -313,22 +326,48 @@ class GA4Client(ReportsClient):
|
|
|
313
326
|
include_totals: bool = True,
|
|
314
327
|
**kwargs: str,
|
|
315
328
|
) -> Optional[RunReportResponse]:
|
|
316
|
-
#
|
|
317
|
-
deduplicated_dimensions =
|
|
329
|
+
# Use the new deduplication method instead of set() to avoid the unhashable error.
|
|
330
|
+
deduplicated_dimensions = self._deduplicate_dimensions(dimensions)
|
|
318
331
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
+
try:
|
|
333
|
+
request = RunReportRequest(
|
|
334
|
+
property=f"properties/{property_id}",
|
|
335
|
+
date_ranges=date_ranges,
|
|
336
|
+
dimensions=deduplicated_dimensions,
|
|
337
|
+
metrics=metrics,
|
|
338
|
+
metric_filter=metric_filter,
|
|
339
|
+
dimension_filter=dimension_filter,
|
|
340
|
+
order_bys=order_bys,
|
|
341
|
+
limit=limit,
|
|
342
|
+
offset=offset,
|
|
343
|
+
keep_empty_rows=True,
|
|
344
|
+
metric_aggregations=(
|
|
345
|
+
[MetricAggregation.TOTAL] if include_totals else None
|
|
346
|
+
),
|
|
347
|
+
)
|
|
348
|
+
report_response = await asyncio.wait_for(
|
|
349
|
+
self._client.run_report(request), timeout=REQUEST_TIMEOUT
|
|
350
|
+
)
|
|
351
|
+
except (TimeoutError, asyncio.exceptions.TimeoutError) as timeout_error:
|
|
352
|
+
LOGGER.warning(
|
|
353
|
+
{
|
|
354
|
+
"error": str(timeout_error),
|
|
355
|
+
"msg": "timeout_error_from_ga4_client",
|
|
356
|
+
"property_id": property_id,
|
|
357
|
+
}
|
|
358
|
+
)
|
|
359
|
+
raise timeout_error
|
|
360
|
+
except Exception as e:
|
|
361
|
+
LOGGER.warning(
|
|
362
|
+
{
|
|
363
|
+
"msg": "failed_to_run_report",
|
|
364
|
+
"property_id": property_id,
|
|
365
|
+
"error": str(e),
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
raise e
|
|
369
|
+
|
|
370
|
+
return report_response
|
|
332
371
|
|
|
333
372
|
@cached(ttl=300, cache=Cache.MEMORY) # Cache results for 5 minutes
|
|
334
373
|
async def _decorated_query(
|
|
@@ -16,7 +16,7 @@ findly/unified_reporting_sdk/data_sources/fb_ads/metadata/dimensions.jsonl,sha25
|
|
|
16
16
|
findly/unified_reporting_sdk/data_sources/fb_ads/metadata/fields.csv,sha256=9FQ8yMY7DuD7NG_3vIlbHg-U2O__MQBZ5oRdX5ZeYIE,17708
|
|
17
17
|
findly/unified_reporting_sdk/data_sources/fb_ads/metadata/metrics.jsonl,sha256=k46VIKAOZiuefpo-umQ7SYZnl8I5NIzP7_KITLfL974,19606
|
|
18
18
|
findly/unified_reporting_sdk/data_sources/ga4/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
-
findly/unified_reporting_sdk/data_sources/ga4/ga4_client.py,sha256=
|
|
19
|
+
findly/unified_reporting_sdk/data_sources/ga4/ga4_client.py,sha256=_HDaDyxecq5CRxyGi1FcGeMismxhqgg598ISMrpIvrQ,39901
|
|
20
20
|
findly/unified_reporting_sdk/data_sources/ga4/ga4_query_args_parser.py,sha256=LKESjdiSYDdcJXO8sae1L-W8zxNU4XdMScuLq1AVCXw,30016
|
|
21
21
|
findly/unified_reporting_sdk/data_sources/ga4/metadata/dimensions.jsonl,sha256=nSecS8Pi0ZTjsd1PlIyqAbYF56Chw2zLYRWetLkG9VQ,33511
|
|
22
22
|
findly/unified_reporting_sdk/data_sources/gsc/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -29,7 +29,7 @@ findly/unified_reporting_sdk/protos/findly_semantic_layer_pb2.pyi,sha256=jjoQm4T
|
|
|
29
29
|
findly/unified_reporting_sdk/urs.py,sha256=-vhOFpi-M0uo_tZ_O_hTDDEGO-ATf78nqEf5JhIcaz4,2956
|
|
30
30
|
findly/unified_reporting_sdk/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
31
|
findly/unified_reporting_sdk/util/create_numeric_string_series.py,sha256=MmufpYatIhcVxA9e3H1dR1CrejXRnA8j4NNjJxfvBVA,457
|
|
32
|
-
findly_unified_reporting_sdk-0.7.
|
|
33
|
-
findly_unified_reporting_sdk-0.7.
|
|
34
|
-
findly_unified_reporting_sdk-0.7.
|
|
35
|
-
findly_unified_reporting_sdk-0.7.
|
|
32
|
+
findly_unified_reporting_sdk-0.7.11.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
33
|
+
findly_unified_reporting_sdk-0.7.11.dist-info/METADATA,sha256=2AId5iefHOUbOK0f20MN7HtkTc_RjSuPUNh8xOjJXUM,3212
|
|
34
|
+
findly_unified_reporting_sdk-0.7.11.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
35
|
+
findly_unified_reporting_sdk-0.7.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|