findly.unified-reporting-sdk 0.7.14__py3-none-any.whl → 0.7.15__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.
@@ -2,6 +2,7 @@ import re
2
2
  import pandas as pd
3
3
  from datetime import datetime
4
4
  from dateutil.relativedelta import relativedelta
5
+ import sqlglot
5
6
 
6
7
  from typing import List, Optional, Callable, Tuple, Any, TypedDict
7
8
  from findly.unified_reporting_sdk.protos.findly_semantic_layer_pb2 import (
@@ -16,6 +17,60 @@ from findly.unified_reporting_sdk.data_sources.common.date_range_helper import (
16
17
  NONE_VALUE = "none"
17
18
  RESERVED_TOTAL = "RESERVED_TOTAL"
18
19
 
20
+ # Regex pattern for valid SQL identifiers
21
+ _IDENTIFIER_PATTERN = re.compile(r"^[a-zA-Z_][a-zA-Z0-9_]*$")
22
+ # Regex pattern for ORDER BY column (identifier with optional ASC/DESC)
23
+ _ORDER_BY_PATTERN = re.compile(r"^([a-zA-Z_][a-zA-Z0-9_]*)\s*(ASC|DESC)?$", re.IGNORECASE)
24
+ # Regex pattern for YYYY-MM-DD date format
25
+ _DATE_PATTERN = re.compile(r"^\d{4}-\d{2}-\d{2}$")
26
+
27
+
28
+ def _validate_identifier(name: str) -> str:
29
+ """Validate that a string is a safe SQL identifier."""
30
+ if not _IDENTIFIER_PATTERN.match(name):
31
+ raise ValueError(f"Invalid SQL identifier: {name!r}")
32
+ return name
33
+
34
+
35
+ def _validate_order_by_column(col: str) -> str:
36
+ """Validate an ORDER BY column (identifier with optional ASC/DESC)."""
37
+ if not _ORDER_BY_PATTERN.match(col):
38
+ raise ValueError(f"Invalid ORDER BY column: {col!r}")
39
+ return col
40
+
41
+
42
+ def _validate_date(date_str: str) -> str:
43
+ """Validate that a string is a valid YYYY-MM-DD date."""
44
+ if not _DATE_PATTERN.match(date_str):
45
+ raise ValueError(f"Invalid date format (expected YYYY-MM-DD): {date_str!r}")
46
+ return date_str
47
+
48
+
49
+ def _validate_positive_integer(value: Any) -> int:
50
+ """Validate that a value is a positive integer."""
51
+ try:
52
+ int_value = int(value)
53
+ except (TypeError, ValueError) as e:
54
+ raise ValueError(f"Invalid integer value: {value!r}") from e
55
+ if int_value <= 0:
56
+ raise ValueError(f"Value must be positive: {int_value}")
57
+ return int_value
58
+
59
+
60
+ def _validate_sql_clause(clause: str, clause_type: str) -> str:
61
+ """Validate a SQL clause (WHERE/HAVING) using sqlglot parsing."""
62
+ if not clause or not clause.strip():
63
+ raise ValueError(f"Empty {clause_type} clause")
64
+ # Wrap in a minimal SELECT statement to validate the clause
65
+ test_query = f"SELECT 1 FROM t {clause_type} {clause}"
66
+ try:
67
+ parsed = sqlglot.parse(test_query)
68
+ if not parsed or parsed[0] is None:
69
+ raise ValueError(f"Failed to parse {clause_type} clause: {clause!r}")
70
+ except sqlglot.errors.ParseError as e:
71
+ raise ValueError(f"Invalid {clause_type} clause: {clause!r}") from e
72
+ return clause
73
+
19
74
 
20
75
  class DefaultFormattedDateRange(TypedDict):
21
76
  since: str
@@ -102,17 +157,24 @@ class CommonParser:
102
157
 
103
158
  Returns:
104
159
  str: The SQL query generated from the QueryArgs object.
160
+
161
+ Raises:
162
+ ValueError: If any input fails validation.
105
163
  """
106
164
  query_parts = []
107
165
 
108
166
  select_parts = []
109
167
  # Metrics and Metrics Expression
110
168
  if query.metrics:
111
- select_parts.append(", ".join(query.metrics))
169
+ validated_metrics = [_validate_identifier(m) for m in query.metrics]
170
+ select_parts.append(", ".join(validated_metrics))
112
171
  elif query.metrics_expression:
113
172
  select_parts.append(", ".join(query.metrics_expression))
114
173
  if query.group_by_columns:
115
- select_parts.append(", ".join(query.group_by_columns))
174
+ validated_group_cols = [
175
+ _validate_identifier(col) for col in query.group_by_columns
176
+ ]
177
+ select_parts.append(", ".join(validated_group_cols))
116
178
  if len(select_parts) > 0:
117
179
  select_str = "SELECT " + ", ".join(select_parts)
118
180
  query_parts.append(select_str)
@@ -123,13 +185,14 @@ class CommonParser:
123
185
  where_clause_modified = re.sub(
124
186
  r"\bwhere\b", "", query.where_clause, flags=re.IGNORECASE
125
187
  ).strip()
188
+ _validate_sql_clause(where_clause_modified, "WHERE")
126
189
  conditions.append(f"WHERE {where_clause_modified}")
127
190
 
128
191
  # Date Where clause
129
192
  if query.date_ranges:
130
193
  for date_range in list(query.date_ranges):
131
- start_date = date_range.start_date
132
- end_date = date_range.end_date
194
+ start_date = _validate_date(date_range.start_date)
195
+ end_date = _validate_date(date_range.end_date)
133
196
  # Check if start and end dates are the same
134
197
  if start_date == end_date:
135
198
  # Use equality condition when dates are the same
@@ -143,7 +206,10 @@ class CommonParser:
143
206
 
144
207
  # Group By
145
208
  if query.group_by_columns:
146
- group_by_str = ", ".join(query.group_by_columns)
209
+ validated_group_cols = [
210
+ _validate_identifier(col) for col in query.group_by_columns
211
+ ]
212
+ group_by_str = ", ".join(validated_group_cols)
147
213
  query_parts.append(f"GROUP BY {group_by_str}")
148
214
 
149
215
  # Having
@@ -151,16 +217,21 @@ class CommonParser:
151
217
  having_clause_modified = re.sub(
152
218
  r"\bhaving\b", "", query.having_clause, flags=re.IGNORECASE
153
219
  ).strip()
220
+ _validate_sql_clause(having_clause_modified, "HAVING")
154
221
  query_parts.append(f"HAVING {having_clause_modified}")
155
222
 
156
223
  # Order By
157
224
  if query.order_by:
158
- order_by_str = ", ".join(query.order_by)
225
+ validated_order_cols = [
226
+ _validate_order_by_column(col) for col in query.order_by
227
+ ]
228
+ order_by_str = ", ".join(validated_order_cols)
159
229
  query_parts.append(f"ORDER BY {order_by_str}")
160
230
 
161
231
  # Limit
162
232
  if query.limit:
163
- query_parts.append(f"LIMIT {query.limit}")
233
+ validated_limit = _validate_positive_integer(query.limit)
234
+ query_parts.append(f"LIMIT {validated_limit}")
164
235
 
165
236
  return "\n".join(query_parts)
166
237
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: findly.unified-reporting-sdk
3
- Version: 0.7.14
3
+ Version: 0.7.15
4
4
  Summary:
5
5
  License: GPL-3.0-only
6
6
  Requires-Python: >=3.9,<4.0
@@ -17,9 +17,8 @@ Requires-Dist: facebook-business (>=22.0.5,<23.0.0)
17
17
  Requires-Dist: google-analytics-admin (>=0.24.0,<0.25.0)
18
18
  Requires-Dist: google-analytics-data (>=0.18.18,<0.19.0)
19
19
  Requires-Dist: google-api-python-client (>=2.169.0,<3.0.0)
20
- Requires-Dist: oauth2client (>=4.1.3,<5.0.0)
21
20
  Requires-Dist: pandas (>=2.2.3,<3.0.0)
22
- Requires-Dist: protobuf (>=4.25.3,<5.0.0)
21
+ Requires-Dist: protobuf (>=6.33.5,<7.0.0)
23
22
  Requires-Dist: sqlglot (>=26.17.1,<27.0.0)
24
23
  Description-Content-Type: text/markdown
25
24
 
@@ -2,7 +2,7 @@ findly/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  findly/unified_reporting_sdk/__init__.py,sha256=1GE1LJq5zf-0fuObZtLXJN6RaxkeByKX3-bgEkzpi6I,342
3
3
  findly/unified_reporting_sdk/data_sources/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  findly/unified_reporting_sdk/data_sources/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- findly/unified_reporting_sdk/data_sources/common/common_parser.py,sha256=76yLDRQkSuf0UyxmadPTZ8qvgOnMeSZNvsd4lygnx34,7866
5
+ findly/unified_reporting_sdk/data_sources/common/common_parser.py,sha256=mT5oOTjVMvtKuv7U-Kasp00fNwRqokfQQEKuCSL9r70,10779
6
6
  findly/unified_reporting_sdk/data_sources/common/date_range_helper.py,sha256=z2L1YU1Mzbybkl1wZK_mXL9lKFfG6CEomvlTfADD_80,971
7
7
  findly/unified_reporting_sdk/data_sources/common/entities.py,sha256=vz6V1KaZVqMpLghFOD-KaBGuTikt1rJFzfpkz53gBbU,243
8
8
  findly/unified_reporting_sdk/data_sources/common/reports_client.py,sha256=zvr6itv2MSV_O1zlhlgiHSWZNMyyjs-2OQG59aWMZLg,3628
@@ -24,10 +24,8 @@ findly/unified_reporting_sdk/data_sources/gsc/gsc_client.py,sha256=47DEQpj8HBSa-
24
24
  findly/unified_reporting_sdk/data_sources/gsc/gsc_service.py,sha256=C6wm38Hu-UozFll71G3b03e2hgLFiC4I5yjcuo9hB4M,934
25
25
  findly/unified_reporting_sdk/protos/.gitignore,sha256=jyvVCY11J1OlOGM-nZCWKSR1vfO6fP65lnH65qf5W20,27
26
26
  findly/unified_reporting_sdk/protos/__init__.py,sha256=sfz7Yn3hvQrnhTfoZPGTbo0F1_Fw4X494wPSZojRajA,137
27
- findly/unified_reporting_sdk/protos/findly_semantic_layer_pb2.py,sha256=SaY46pOt8sDiVWrpY_f0uDwfgm_OPcHUkCdetnbPnUw,7279
28
- findly/unified_reporting_sdk/protos/findly_semantic_layer_pb2.pyi,sha256=jjoQm4TljpS8pcF6bqj21ygTQ-ayCzS3ScrRtbd5hPA,31043
29
27
  findly/unified_reporting_sdk/urs.py,sha256=-vhOFpi-M0uo_tZ_O_hTDDEGO-ATf78nqEf5JhIcaz4,2956
30
- findly_unified_reporting_sdk-0.7.14.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
31
- findly_unified_reporting_sdk-0.7.14.dist-info/METADATA,sha256=0zNhdl6yBerd1pxBEOGD0qA-K67Hni8_yLi63-8brvo,3213
32
- findly_unified_reporting_sdk-0.7.14.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
33
- findly_unified_reporting_sdk-0.7.14.dist-info/RECORD,,
28
+ findly_unified_reporting_sdk-0.7.15.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
29
+ findly_unified_reporting_sdk-0.7.15.dist-info/METADATA,sha256=pCoiJxhjzvaUJcJm8gvd086pDU_gg4qwthPmbdx3YtA,3168
30
+ findly_unified_reporting_sdk-0.7.15.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
31
+ findly_unified_reporting_sdk-0.7.15.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.1.3
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
@@ -1,51 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- # Generated by the protocol buffer compiler. DO NOT EDIT!
3
- # source: findly_semantic_layer.proto
4
- """Generated protocol buffer code."""
5
- from google.protobuf import descriptor as _descriptor
6
- from google.protobuf import descriptor_pool as _descriptor_pool
7
- from google.protobuf import symbol_database as _symbol_database
8
- from google.protobuf.internal import builder as _builder
9
- # @@protoc_insertion_point(imports)
10
-
11
- _sym_db = _symbol_database.Default()
12
-
13
-
14
-
15
-
16
- DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1b\x66indly_semantic_layer.proto\x12\x15\x66indly_semantic_layer\"\xd4\x02\n\tDimension\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0c\n\x04\x65xpr\x18\x03 \x01(\t\x12\x32\n\x04type\x18\x04 \x01(\x0e\x32$.findly_semantic_layer.DimensionType\x12?\n\x0btype_params\x18\x05 \x01(\x0b\x32*.findly_semantic_layer.DimensionTypeParams\x12\x14\n\x0ctop_n_values\x18\x06 \x03(\t\x12\x16\n\nvalue_type\x18\x07 \x01(\tB\x02\x18\x01\x12\x19\n\x11\x64\x61ta_source_names\x18\x08 \x03(\t\x12\x14\n\x0c\x64isplay_name\x18\t \x01(\t\x12\x42\n\x0fvalue_type_enum\x18\n \x01(\x0e\x32).findly_semantic_layer.DimensionValueType\"k\n\x13\x44imensionTypeParams\x12@\n\x10time_granularity\x18\x01 \x01(\x0e\x32&.findly_semantic_layer.DateGranularity\x12\x12\n\nis_primary\x18\x02 \x01(\x08\"\x8b\x03\n\x06Metric\x12\n\n\x02id\x18\x01 \x01(\t\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x03 \x01(\t\x12\x12\n\nexpression\x18\x04 \x01(\t\x12\x18\n\x10view_id_of_table\x18\x05 \x01(\t\x12\x12\n\ntable_name\x18\x06 \x01(\t\x12\x10\n\x08measures\x18\x07 \x03(\t\x12\x11\n\tnumerator\x18\x08 \x01(\t\x12\x13\n\x0b\x64\x65nominator\x18\t \x01(\t\x12/\n\x04type\x18\n \x01(\x0e\x32!.findly_semantic_layer.MetricType\x12\x10\n\x06window\x18\x0b \x01(\tH\x00\x12\x17\n\rgrain_to_date\x18\x0c \x01(\tH\x00\x12:\n\nvalue_type\x18\r \x01(\x0e\x32&.findly_semantic_layer.MetricValueType\x12\x14\n\x0c\x64isplay_name\x18\x0e \x01(\t\x12\x12\n\nis_numeric\x18\x0f \x01(\x08\x42\x14\n\x12\x63umulative_process\"4\n\x0c\x44\x61teStrRange\x12\x12\n\nstart_date\x18\x01 \x01(\t\x12\x10\n\x08\x65nd_date\x18\x02 \x01(\t\"\x93\x03\n\tQueryArgs\x12\x14\n\x0cwhere_clause\x18\x01 \x01(\t\x12\x18\n\x10group_by_columns\x18\x02 \x03(\t\x12\x1a\n\x12metrics_expression\x18\x03 \x03(\t\x12\r\n\x05limit\x18\x04 \x01(\t\x12\x10\n\x08order_by\x18\x05 \x03(\t\x12\x19\n\x11\x64\x61te_where_clause\x18\x06 \x01(\t\x12\x0f\n\x07metrics\x18\x07 \x03(\t\x12\x15\n\rhaving_clause\x18\x08 \x01(\t\x12\x1c\n\x14incompatible_metrics\x18\t \x03(\t\x12\x1f\n\x17incompatible_dimensions\x18\n \x03(\t\x12\x38\n\x0b\x64\x61te_ranges\x18\x0b \x03(\x0b\x32#.findly_semantic_layer.DateStrRange\x12\x17\n\x0fsql_explanation\x18\x0c \x01(\t\x12\r\n\x05level\x18\r \x01(\t\x12\x16\n\x0etime_increment\x18\x0e \x01(\t\x12\x1d\n\x15main_data_source_name\x18\x0f \x01(\t\"\x80\x01\n\x12\x44\x61tasourceMetadata\x12>\n\x08location\x18\x01 \x01(\x0e\x32,.findly_semantic_layer.DataSourceIntegration\x12\x13\n\x0bproperty_id\x18\x02 \x01(\t\x12\x15\n\rproperty_name\x18\x03 \x01(\t*b\n\x15\x44\x61taSourceIntegration\x12 \n\x1c\x44\x41TA_SOURCE_LOCATION_UNKNOWN\x10\x00\x12\x12\n\x0eSEMANTIC_LAYER\x10\x01\x12\x07\n\x03GA4\x10\x02\x12\n\n\x06\x46\x42_ADS\x10\x03*S\n\x0f\x44\x61teGranularity\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x07\n\x03\x44\x41Y\x10\x01\x12\x08\n\x04WEEK\x10\x02\x12\t\n\x05MONTH\x10\x03\x12\x0b\n\x07QUARTER\x10\x04\x12\x08\n\x04YEAR\x10\x05*\x7f\n\x0b\x41ggregation\x12\x17\n\x13\x41GGREGATION_UNKNOWN\x10\x00\x12\x07\n\x03SUM\x10\x01\x12\x0f\n\x0bSUM_BOOLEAN\x10\x02\x12\x12\n\x0e\x43OUNT_DISTINCT\x10\x03\x12\x07\n\x03MIN\x10\x04\x12\x07\n\x03MAX\x10\x05\x12\x0b\n\x07\x41VERAGE\x10\x06\x12\n\n\x06MEDIAN\x10\x07*\xab\x01\n\rDimensionType\x12\x15\n\x11\x44IMENSION_UNKNOWN\x10\x00\x12\x0f\n\x0b\x43\x41TEGORICAL\x10\x01\x12\x08\n\x04TIME\x10\x02\x12\x10\n\x0c\x46\x42_ADS_FIELD\x10\x03\x12\x14\n\x10\x46\x42_ADS_BREAKDOWN\x10\x04\x12\x1b\n\x17\x46\x42_ADS_ACTION_BREAKDOWN\x10\x05\x12#\n\x1f\x46\x42_ADS_SUMMARY_ACTION_BREAKDOWN\x10\x06*\x84\x01\n\x12\x44imensionValueType\x12\x16\n\x12VALUE_TYPE_UNKNOWN\x10\x00\x12\n\n\x06STRING\x10\x01\x12\x0b\n\x07INTEGER\x10\x02\x12\t\n\x05\x46LOAT\x10\x03\x12\x0b\n\x07\x42OOLEAN\x10\x04\x12\x08\n\x04\x44\x41TE\x10\x05\x12\x0c\n\x08\x44\x41TETIME\x10\x06\x12\r\n\tTIMESTAMP\x10\x07*o\n\nMetricType\x12\x12\n\x0eMETRIC_UNKNOWN\x10\x00\x12\x11\n\rMEASURE_PROXY\x10\x01\x12\x0e\n\nCUMULATIVE\x10\x02\x12\t\n\x05RATIO\x10\x03\x12\x0b\n\x07\x44\x45RIVED\x10\x04\x12\x12\n\x0eSQL_EXPRESSION\x10\x05*\xf9\x04\n\x0fMetricValueType\x12\x1d\n\x19METRIC_VALUE_TYPE_UNKNOWN\x10\x00\x12\x1d\n\x19METRIC_VALUE_TYPE_INTEGER\x10\x01\x12\x1b\n\x17METRIC_VALUE_TYPE_FLOAT\x10\x02\x12\x1d\n\x19METRIC_VALUE_TYPE_SECONDS\x10\x03\x12\"\n\x1eMETRIC_VALUE_TYPE_MILLISECONDS\x10\x04\x12\x1d\n\x19METRIC_VALUE_TYPE_MINUTES\x10\x05\x12\x1b\n\x17METRIC_VALUE_TYPE_HOURS\x10\x06\x12\x1e\n\x1aMETRIC_VALUE_TYPE_STANDARD\x10\x07\x12\x1e\n\x1aMETRIC_VALUE_TYPE_CURRENCY\x10\x08\x12\x1a\n\x16METRIC_VALUE_TYPE_FEET\x10\t\x12\x1b\n\x17METRIC_VALUE_TYPE_MILES\x10\n\x12\x1c\n\x18METRIC_VALUE_TYPE_METERS\x10\x0b\x12 \n\x1cMETRIC_VALUE_TYPE_KILOMETERS\x10\x0c\x12\x1c\n\x18METRIC_VALUE_TYPE_STRING\x10\r\x12$\n METRIC_VALUE_TYPE_NUMERIC_STRING\x10\x0e\x12+\n\'METRIC_VALUE_TYPE_LIST_ADS_ACTION_STATS\x10\x0f\x12\x32\n.METRIC_VALUE_TYPE_LIST_ADS_INSIGHTS_DDA_RESULT\x10\x10\x12.\n*METRIC_VALUE_TYPE_LIST_ADS_HISTOGRAM_STATS\x10\x11\x62\x06proto3')
17
-
18
- _globals = globals()
19
- _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
20
- _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'findly_semantic_layer_pb2', _globals)
21
- if _descriptor._USE_C_DESCRIPTORS == False:
22
- DESCRIPTOR._options = None
23
- _globals['_DIMENSION'].fields_by_name['value_type']._options = None
24
- _globals['_DIMENSION'].fields_by_name['value_type']._serialized_options = b'\030\001'
25
- _globals['_DATASOURCEINTEGRATION']._serialized_start=1495
26
- _globals['_DATASOURCEINTEGRATION']._serialized_end=1593
27
- _globals['_DATEGRANULARITY']._serialized_start=1595
28
- _globals['_DATEGRANULARITY']._serialized_end=1678
29
- _globals['_AGGREGATION']._serialized_start=1680
30
- _globals['_AGGREGATION']._serialized_end=1807
31
- _globals['_DIMENSIONTYPE']._serialized_start=1810
32
- _globals['_DIMENSIONTYPE']._serialized_end=1981
33
- _globals['_DIMENSIONVALUETYPE']._serialized_start=1984
34
- _globals['_DIMENSIONVALUETYPE']._serialized_end=2116
35
- _globals['_METRICTYPE']._serialized_start=2118
36
- _globals['_METRICTYPE']._serialized_end=2229
37
- _globals['_METRICVALUETYPE']._serialized_start=2232
38
- _globals['_METRICVALUETYPE']._serialized_end=2865
39
- _globals['_DIMENSION']._serialized_start=55
40
- _globals['_DIMENSION']._serialized_end=395
41
- _globals['_DIMENSIONTYPEPARAMS']._serialized_start=397
42
- _globals['_DIMENSIONTYPEPARAMS']._serialized_end=504
43
- _globals['_METRIC']._serialized_start=507
44
- _globals['_METRIC']._serialized_end=902
45
- _globals['_DATESTRRANGE']._serialized_start=904
46
- _globals['_DATESTRRANGE']._serialized_end=956
47
- _globals['_QUERYARGS']._serialized_start=959
48
- _globals['_QUERYARGS']._serialized_end=1362
49
- _globals['_DATASOURCEMETADATA']._serialized_start=1365
50
- _globals['_DATASOURCEMETADATA']._serialized_end=1493
51
- # @@protoc_insertion_point(module_scope)
@@ -1,602 +0,0 @@
1
- """
2
- @generated by mypy-protobuf. Do not edit manually!
3
- isort:skip_file
4
- """
5
-
6
- import builtins
7
- import collections.abc
8
- import google.protobuf.descriptor
9
- import google.protobuf.internal.containers
10
- import google.protobuf.internal.enum_type_wrapper
11
- import google.protobuf.message
12
- import sys
13
- import typing
14
-
15
- if sys.version_info >= (3, 10):
16
- import typing as typing_extensions
17
- else:
18
- import typing_extensions
19
-
20
- DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
21
-
22
- class _DataSourceIntegration:
23
- ValueType = typing.NewType("ValueType", builtins.int)
24
- V: typing_extensions.TypeAlias = ValueType
25
-
26
- class _DataSourceIntegrationEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_DataSourceIntegration.ValueType], builtins.type):
27
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
28
- DATA_SOURCE_LOCATION_UNKNOWN: _DataSourceIntegration.ValueType # 0
29
- SEMANTIC_LAYER: _DataSourceIntegration.ValueType # 1
30
- GA4: _DataSourceIntegration.ValueType # 2
31
- FB_ADS: _DataSourceIntegration.ValueType # 3
32
-
33
- class DataSourceIntegration(_DataSourceIntegration, metaclass=_DataSourceIntegrationEnumTypeWrapper): ...
34
-
35
- DATA_SOURCE_LOCATION_UNKNOWN: DataSourceIntegration.ValueType # 0
36
- SEMANTIC_LAYER: DataSourceIntegration.ValueType # 1
37
- GA4: DataSourceIntegration.ValueType # 2
38
- FB_ADS: DataSourceIntegration.ValueType # 3
39
- global___DataSourceIntegration = DataSourceIntegration
40
-
41
- class _DateGranularity:
42
- ValueType = typing.NewType("ValueType", builtins.int)
43
- V: typing_extensions.TypeAlias = ValueType
44
-
45
- class _DateGranularityEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_DateGranularity.ValueType], builtins.type):
46
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
47
- UNKNOWN: _DateGranularity.ValueType # 0
48
- DAY: _DateGranularity.ValueType # 1
49
- WEEK: _DateGranularity.ValueType # 2
50
- MONTH: _DateGranularity.ValueType # 3
51
- QUARTER: _DateGranularity.ValueType # 4
52
- YEAR: _DateGranularity.ValueType # 5
53
-
54
- class DateGranularity(_DateGranularity, metaclass=_DateGranularityEnumTypeWrapper): ...
55
-
56
- UNKNOWN: DateGranularity.ValueType # 0
57
- DAY: DateGranularity.ValueType # 1
58
- WEEK: DateGranularity.ValueType # 2
59
- MONTH: DateGranularity.ValueType # 3
60
- QUARTER: DateGranularity.ValueType # 4
61
- YEAR: DateGranularity.ValueType # 5
62
- global___DateGranularity = DateGranularity
63
-
64
- class _Aggregation:
65
- ValueType = typing.NewType("ValueType", builtins.int)
66
- V: typing_extensions.TypeAlias = ValueType
67
-
68
- class _AggregationEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_Aggregation.ValueType], builtins.type):
69
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
70
- AGGREGATION_UNKNOWN: _Aggregation.ValueType # 0
71
- SUM: _Aggregation.ValueType # 1
72
- SUM_BOOLEAN: _Aggregation.ValueType # 2
73
- COUNT_DISTINCT: _Aggregation.ValueType # 3
74
- MIN: _Aggregation.ValueType # 4
75
- MAX: _Aggregation.ValueType # 5
76
- AVERAGE: _Aggregation.ValueType # 6
77
- MEDIAN: _Aggregation.ValueType # 7
78
-
79
- class Aggregation(_Aggregation, metaclass=_AggregationEnumTypeWrapper): ...
80
-
81
- AGGREGATION_UNKNOWN: Aggregation.ValueType # 0
82
- SUM: Aggregation.ValueType # 1
83
- SUM_BOOLEAN: Aggregation.ValueType # 2
84
- COUNT_DISTINCT: Aggregation.ValueType # 3
85
- MIN: Aggregation.ValueType # 4
86
- MAX: Aggregation.ValueType # 5
87
- AVERAGE: Aggregation.ValueType # 6
88
- MEDIAN: Aggregation.ValueType # 7
89
- global___Aggregation = Aggregation
90
-
91
- class _DimensionType:
92
- ValueType = typing.NewType("ValueType", builtins.int)
93
- V: typing_extensions.TypeAlias = ValueType
94
-
95
- class _DimensionTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_DimensionType.ValueType], builtins.type):
96
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
97
- DIMENSION_UNKNOWN: _DimensionType.ValueType # 0
98
- CATEGORICAL: _DimensionType.ValueType # 1
99
- """Category dimensions allow metrics to be grouped by different "category" slices and dices, such as product type, color, or geographical area.
100
- These may point to existing columns in the data table, or be calculated using a SQL expression with the expr parameter.
101
- """
102
- TIME: _DimensionType.ValueType # 2
103
- """Time dimensions are used to aggregate metrics against different levels of time granularity.
104
- An Aggregation time dimension for measures must be set! This should either be set directly on the measure specification in the model, or else defaulted to the primary time dimension in the data source containing the measure.
105
- """
106
- FB_ADS_FIELD: _DimensionType.ValueType # 3
107
- """Here are the possible types for FB Ads Dimensions"""
108
- FB_ADS_BREAKDOWN: _DimensionType.ValueType # 4
109
- FB_ADS_ACTION_BREAKDOWN: _DimensionType.ValueType # 5
110
- FB_ADS_SUMMARY_ACTION_BREAKDOWN: _DimensionType.ValueType # 6
111
-
112
- class DimensionType(_DimensionType, metaclass=_DimensionTypeEnumTypeWrapper): ...
113
-
114
- DIMENSION_UNKNOWN: DimensionType.ValueType # 0
115
- CATEGORICAL: DimensionType.ValueType # 1
116
- """Category dimensions allow metrics to be grouped by different "category" slices and dices, such as product type, color, or geographical area.
117
- These may point to existing columns in the data table, or be calculated using a SQL expression with the expr parameter.
118
- """
119
- TIME: DimensionType.ValueType # 2
120
- """Time dimensions are used to aggregate metrics against different levels of time granularity.
121
- An Aggregation time dimension for measures must be set! This should either be set directly on the measure specification in the model, or else defaulted to the primary time dimension in the data source containing the measure.
122
- """
123
- FB_ADS_FIELD: DimensionType.ValueType # 3
124
- """Here are the possible types for FB Ads Dimensions"""
125
- FB_ADS_BREAKDOWN: DimensionType.ValueType # 4
126
- FB_ADS_ACTION_BREAKDOWN: DimensionType.ValueType # 5
127
- FB_ADS_SUMMARY_ACTION_BREAKDOWN: DimensionType.ValueType # 6
128
- global___DimensionType = DimensionType
129
-
130
- class _DimensionValueType:
131
- ValueType = typing.NewType("ValueType", builtins.int)
132
- V: typing_extensions.TypeAlias = ValueType
133
-
134
- class _DimensionValueTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_DimensionValueType.ValueType], builtins.type):
135
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
136
- VALUE_TYPE_UNKNOWN: _DimensionValueType.ValueType # 0
137
- STRING: _DimensionValueType.ValueType # 1
138
- INTEGER: _DimensionValueType.ValueType # 2
139
- FLOAT: _DimensionValueType.ValueType # 3
140
- BOOLEAN: _DimensionValueType.ValueType # 4
141
- DATE: _DimensionValueType.ValueType # 5
142
- DATETIME: _DimensionValueType.ValueType # 6
143
- TIMESTAMP: _DimensionValueType.ValueType # 7
144
-
145
- class DimensionValueType(_DimensionValueType, metaclass=_DimensionValueTypeEnumTypeWrapper): ...
146
-
147
- VALUE_TYPE_UNKNOWN: DimensionValueType.ValueType # 0
148
- STRING: DimensionValueType.ValueType # 1
149
- INTEGER: DimensionValueType.ValueType # 2
150
- FLOAT: DimensionValueType.ValueType # 3
151
- BOOLEAN: DimensionValueType.ValueType # 4
152
- DATE: DimensionValueType.ValueType # 5
153
- DATETIME: DimensionValueType.ValueType # 6
154
- TIMESTAMP: DimensionValueType.ValueType # 7
155
- global___DimensionValueType = DimensionValueType
156
-
157
- class _MetricType:
158
- ValueType = typing.NewType("ValueType", builtins.int)
159
- V: typing_extensions.TypeAlias = ValueType
160
-
161
- class _MetricTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_MetricType.ValueType], builtins.type):
162
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
163
- METRIC_UNKNOWN: _MetricType.ValueType # 0
164
- MEASURE_PROXY: _MetricType.ValueType # 1
165
- """Measure proxies are metrics that point directly to a measure (you may think of the measure proxy as a function that takes only ONE measure as the input).
166
- Note that if a measure has already been defined in a data source with the create_metric: True parameter, you do not need to re-define a metric for the measure, and you can simply use the measure itself.
167
- However, if you would like to include a constraint on top of the measure, you will need to create a measure proxy.
168
- For example, if you would like to create a metric that only includes orders with a price greater than 100, you can create a measure proxy with the constraint price > 100.
169
- If using a measure proxy, you must specify the measure in the measures parameter. Don't use the expression field as it will be ignored.
170
- """
171
- CUMULATIVE: _MetricType.ValueType # 2
172
- """Cumulative metrics aggregate a measure over a given window.
173
- Note that if no window is specified, the window would accumulate the measure over all time.
174
- """
175
- RATIO: _MetricType.ValueType # 3
176
- """Ratio metrics involve a numerator measure and a denominator measure.
177
- Note that if an optional constraint string is applied, the constraint is applied to both the numerator and denominator.
178
- """
179
- DERIVED: _MetricType.ValueType # 4
180
- SQL_EXPRESSION: _MetricType.ValueType # 5
181
- """When you are building a metric that involves a SQL expression of multiple measures, you can use an expression metric."""
182
-
183
- class MetricType(_MetricType, metaclass=_MetricTypeEnumTypeWrapper):
184
- """Based on https://docs.getdbt.com/docs/build/metrics-
185
- Only MEASURE_PROXY and RATIO are supported for now. Don't use the other types.
186
- """
187
-
188
- METRIC_UNKNOWN: MetricType.ValueType # 0
189
- MEASURE_PROXY: MetricType.ValueType # 1
190
- """Measure proxies are metrics that point directly to a measure (you may think of the measure proxy as a function that takes only ONE measure as the input).
191
- Note that if a measure has already been defined in a data source with the create_metric: True parameter, you do not need to re-define a metric for the measure, and you can simply use the measure itself.
192
- However, if you would like to include a constraint on top of the measure, you will need to create a measure proxy.
193
- For example, if you would like to create a metric that only includes orders with a price greater than 100, you can create a measure proxy with the constraint price > 100.
194
- If using a measure proxy, you must specify the measure in the measures parameter. Don't use the expression field as it will be ignored.
195
- """
196
- CUMULATIVE: MetricType.ValueType # 2
197
- """Cumulative metrics aggregate a measure over a given window.
198
- Note that if no window is specified, the window would accumulate the measure over all time.
199
- """
200
- RATIO: MetricType.ValueType # 3
201
- """Ratio metrics involve a numerator measure and a denominator measure.
202
- Note that if an optional constraint string is applied, the constraint is applied to both the numerator and denominator.
203
- """
204
- DERIVED: MetricType.ValueType # 4
205
- SQL_EXPRESSION: MetricType.ValueType # 5
206
- """When you are building a metric that involves a SQL expression of multiple measures, you can use an expression metric."""
207
- global___MetricType = MetricType
208
-
209
- class _MetricValueType:
210
- ValueType = typing.NewType("ValueType", builtins.int)
211
- V: typing_extensions.TypeAlias = ValueType
212
-
213
- class _MetricValueTypeEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTypeWrapper[_MetricValueType.ValueType], builtins.type):
214
- DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor
215
- METRIC_VALUE_TYPE_UNKNOWN: _MetricValueType.ValueType # 0
216
- """These are the types from GA4"""
217
- METRIC_VALUE_TYPE_INTEGER: _MetricValueType.ValueType # 1
218
- """Integer type."""
219
- METRIC_VALUE_TYPE_FLOAT: _MetricValueType.ValueType # 2
220
- """Floating point type."""
221
- METRIC_VALUE_TYPE_SECONDS: _MetricValueType.ValueType # 3
222
- """A duration of seconds; a special floating point type."""
223
- METRIC_VALUE_TYPE_MILLISECONDS: _MetricValueType.ValueType # 4
224
- """A duration in milliseconds; a special floating point type."""
225
- METRIC_VALUE_TYPE_MINUTES: _MetricValueType.ValueType # 5
226
- """A duration in minutes; a special floating point type."""
227
- METRIC_VALUE_TYPE_HOURS: _MetricValueType.ValueType # 6
228
- """A duration in hours; a special floating point type."""
229
- METRIC_VALUE_TYPE_STANDARD: _MetricValueType.ValueType # 7
230
- """A custom metric of standard type; a special floating point type."""
231
- METRIC_VALUE_TYPE_CURRENCY: _MetricValueType.ValueType # 8
232
- """An amount of money; a special floating point type."""
233
- METRIC_VALUE_TYPE_FEET: _MetricValueType.ValueType # 9
234
- """A length in feet; a special floating point type."""
235
- METRIC_VALUE_TYPE_MILES: _MetricValueType.ValueType # 10
236
- """A length in miles; a special floating point type."""
237
- METRIC_VALUE_TYPE_METERS: _MetricValueType.ValueType # 11
238
- """A length in meters; a special floating point type."""
239
- METRIC_VALUE_TYPE_KILOMETERS: _MetricValueType.ValueType # 12
240
- """A length in kilometers; a special floating point type."""
241
- METRIC_VALUE_TYPE_STRING: _MetricValueType.ValueType # 13
242
- """Now, these are the types from FB ADS."""
243
- METRIC_VALUE_TYPE_NUMERIC_STRING: _MetricValueType.ValueType # 14
244
- METRIC_VALUE_TYPE_LIST_ADS_ACTION_STATS: _MetricValueType.ValueType # 15
245
- """A single action for a Statistics result -> https://github.com/facebook/facebook-python-business-sdk/blob/main/facebook_business/adobjects/adsactionstats.py"""
246
- METRIC_VALUE_TYPE_LIST_ADS_INSIGHTS_DDA_RESULT: _MetricValueType.ValueType # 16
247
- METRIC_VALUE_TYPE_LIST_ADS_HISTOGRAM_STATS: _MetricValueType.ValueType # 17
248
-
249
- class MetricValueType(_MetricValueType, metaclass=_MetricValueTypeEnumTypeWrapper):
250
- """The value type of the metric, e.g. INTEGER, FLOAT, etc.
251
- Based on https://developers.google.com/analytics/devguides/reporting/data/v1/rest/v1beta/MetricType.
252
- And also on https://developers.facebook.com/docs/marketing-api/reference/ad-account/insights/.
253
- """
254
-
255
- METRIC_VALUE_TYPE_UNKNOWN: MetricValueType.ValueType # 0
256
- """These are the types from GA4"""
257
- METRIC_VALUE_TYPE_INTEGER: MetricValueType.ValueType # 1
258
- """Integer type."""
259
- METRIC_VALUE_TYPE_FLOAT: MetricValueType.ValueType # 2
260
- """Floating point type."""
261
- METRIC_VALUE_TYPE_SECONDS: MetricValueType.ValueType # 3
262
- """A duration of seconds; a special floating point type."""
263
- METRIC_VALUE_TYPE_MILLISECONDS: MetricValueType.ValueType # 4
264
- """A duration in milliseconds; a special floating point type."""
265
- METRIC_VALUE_TYPE_MINUTES: MetricValueType.ValueType # 5
266
- """A duration in minutes; a special floating point type."""
267
- METRIC_VALUE_TYPE_HOURS: MetricValueType.ValueType # 6
268
- """A duration in hours; a special floating point type."""
269
- METRIC_VALUE_TYPE_STANDARD: MetricValueType.ValueType # 7
270
- """A custom metric of standard type; a special floating point type."""
271
- METRIC_VALUE_TYPE_CURRENCY: MetricValueType.ValueType # 8
272
- """An amount of money; a special floating point type."""
273
- METRIC_VALUE_TYPE_FEET: MetricValueType.ValueType # 9
274
- """A length in feet; a special floating point type."""
275
- METRIC_VALUE_TYPE_MILES: MetricValueType.ValueType # 10
276
- """A length in miles; a special floating point type."""
277
- METRIC_VALUE_TYPE_METERS: MetricValueType.ValueType # 11
278
- """A length in meters; a special floating point type."""
279
- METRIC_VALUE_TYPE_KILOMETERS: MetricValueType.ValueType # 12
280
- """A length in kilometers; a special floating point type."""
281
- METRIC_VALUE_TYPE_STRING: MetricValueType.ValueType # 13
282
- """Now, these are the types from FB ADS."""
283
- METRIC_VALUE_TYPE_NUMERIC_STRING: MetricValueType.ValueType # 14
284
- METRIC_VALUE_TYPE_LIST_ADS_ACTION_STATS: MetricValueType.ValueType # 15
285
- """A single action for a Statistics result -> https://github.com/facebook/facebook-python-business-sdk/blob/main/facebook_business/adobjects/adsactionstats.py"""
286
- METRIC_VALUE_TYPE_LIST_ADS_INSIGHTS_DDA_RESULT: MetricValueType.ValueType # 16
287
- METRIC_VALUE_TYPE_LIST_ADS_HISTOGRAM_STATS: MetricValueType.ValueType # 17
288
- global___MetricValueType = MetricValueType
289
-
290
- @typing.final
291
- class Dimension(google.protobuf.message.Message):
292
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
293
-
294
- NAME_FIELD_NUMBER: builtins.int
295
- DESCRIPTION_FIELD_NUMBER: builtins.int
296
- EXPR_FIELD_NUMBER: builtins.int
297
- TYPE_FIELD_NUMBER: builtins.int
298
- TYPE_PARAMS_FIELD_NUMBER: builtins.int
299
- TOP_N_VALUES_FIELD_NUMBER: builtins.int
300
- VALUE_TYPE_FIELD_NUMBER: builtins.int
301
- DATA_SOURCE_NAMES_FIELD_NUMBER: builtins.int
302
- DISPLAY_NAME_FIELD_NUMBER: builtins.int
303
- VALUE_TYPE_ENUM_FIELD_NUMBER: builtins.int
304
- name: builtins.str
305
- """The name of the dimension."""
306
- description: builtins.str
307
- """The description of the dimension."""
308
- expr: builtins.str
309
- """The expression defining the dimension e.g. order_id
310
- Beware that there is no matching signature for operator BETWEEN for argument type DATETIME
311
- And we want to define a date range of interest for our queries
312
- Use DATE_TRUNC(CAST(dimension.name, DATETIME), DateGranularity) to ensure we can use WHERE date range correctly
313
- """
314
- type: global___DimensionType.ValueType
315
- """The type of the dimension, e.g. CATEGORICAL or TIME."""
316
- value_type: builtins.str
317
- """The type of the values of the dimension, e.g. STRING, INTEGER, FLOAT, etc.
318
- Prefer to use the value_type_enum field
319
- """
320
- display_name: builtins.str
321
- """The display name."""
322
- value_type_enum: global___DimensionValueType.ValueType
323
- @property
324
- def type_params(self) -> global___DimensionTypeParams:
325
- """The parameters of the dimension type."""
326
-
327
- @property
328
- def top_n_values(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
329
- """The top n values of the dimension."""
330
-
331
- @property
332
- def data_source_names(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
333
- """The data source names that the dimension is available in."""
334
-
335
- def __init__(
336
- self,
337
- *,
338
- name: builtins.str = ...,
339
- description: builtins.str = ...,
340
- expr: builtins.str = ...,
341
- type: global___DimensionType.ValueType = ...,
342
- type_params: global___DimensionTypeParams | None = ...,
343
- top_n_values: collections.abc.Iterable[builtins.str] | None = ...,
344
- value_type: builtins.str = ...,
345
- data_source_names: collections.abc.Iterable[builtins.str] | None = ...,
346
- display_name: builtins.str = ...,
347
- value_type_enum: global___DimensionValueType.ValueType = ...,
348
- ) -> None: ...
349
- def HasField(self, field_name: typing.Literal["type_params", b"type_params"]) -> builtins.bool: ...
350
- def ClearField(self, field_name: typing.Literal["data_source_names", b"data_source_names", "description", b"description", "display_name", b"display_name", "expr", b"expr", "name", b"name", "top_n_values", b"top_n_values", "type", b"type", "type_params", b"type_params", "value_type", b"value_type", "value_type_enum", b"value_type_enum"]) -> None: ...
351
-
352
- global___Dimension = Dimension
353
-
354
- @typing.final
355
- class DimensionTypeParams(google.protobuf.message.Message):
356
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
357
-
358
- TIME_GRANULARITY_FIELD_NUMBER: builtins.int
359
- IS_PRIMARY_FIELD_NUMBER: builtins.int
360
- time_granularity: global___DateGranularity.ValueType
361
- """The date granularity of the dimension if it is a time dimension."""
362
- is_primary: builtins.bool
363
- """Note for Time dimensions: For data sources with a measure involved, a primary time dimension is required (notice the is_primary: True parameter).
364
- Set the is_primary parameter to True to indicate the time dimension that is to be the primary, or preferred, time dimension for a measure (or metric).
365
- """
366
- def __init__(
367
- self,
368
- *,
369
- time_granularity: global___DateGranularity.ValueType = ...,
370
- is_primary: builtins.bool = ...,
371
- ) -> None: ...
372
- def ClearField(self, field_name: typing.Literal["is_primary", b"is_primary", "time_granularity", b"time_granularity"]) -> None: ...
373
-
374
- global___DimensionTypeParams = DimensionTypeParams
375
-
376
- @typing.final
377
- class Metric(google.protobuf.message.Message):
378
- """Parameters that are associated with metrics include:
379
-
380
- name: Provide the reference name for the metric. This name must be unique amongst all metrics.
381
- owners: Define the list of Technical Owners of this metric via email.
382
- type: Define the type of metric, which can be a measure (measure_proxy), ratio (ratio), SQL expression (expr), or cumulative (cumulative).
383
- """
384
-
385
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
386
-
387
- ID_FIELD_NUMBER: builtins.int
388
- NAME_FIELD_NUMBER: builtins.int
389
- DESCRIPTION_FIELD_NUMBER: builtins.int
390
- EXPRESSION_FIELD_NUMBER: builtins.int
391
- VIEW_ID_OF_TABLE_FIELD_NUMBER: builtins.int
392
- TABLE_NAME_FIELD_NUMBER: builtins.int
393
- MEASURES_FIELD_NUMBER: builtins.int
394
- NUMERATOR_FIELD_NUMBER: builtins.int
395
- DENOMINATOR_FIELD_NUMBER: builtins.int
396
- TYPE_FIELD_NUMBER: builtins.int
397
- WINDOW_FIELD_NUMBER: builtins.int
398
- GRAIN_TO_DATE_FIELD_NUMBER: builtins.int
399
- VALUE_TYPE_FIELD_NUMBER: builtins.int
400
- DISPLAY_NAME_FIELD_NUMBER: builtins.int
401
- IS_NUMERIC_FIELD_NUMBER: builtins.int
402
- id: builtins.str
403
- """The unique identifier of the metric."""
404
- name: builtins.str
405
- """The name of the metric."""
406
- description: builtins.str
407
- """The description of the metric.
408
- The metric name and description should correctly translate the metric's expression.
409
- """
410
- expression: builtins.str
411
- """The expression defining the metric e.g. revenue would have
412
- expression = transactions.price * transactions.quantity
413
- Shouldn't be used if type is MEASURE_PROXY.
414
- Always create simple expressions. If you need to create a complex expression, create a measure in the data source and use it in the metric.
415
- Two different metrics should not have the same expression.
416
- e.g. x+y , x-y, x*y, x/y, x%y, x^y, x/y*z, x+y*z, x-y*z, x+y/z, x-y/z, etc.
417
- """
418
- view_id_of_table: builtins.str
419
- """The id of the table view that the metric is defined on."""
420
- table_name: builtins.str
421
- """The name of the table view that the metric is defined on."""
422
- numerator: builtins.str
423
- """Numerator and denominator are only used if type is RATIO. Don't use identifiers as numerator or denominator.
424
- It should be included only measures that are defined in a data source.
425
- We also probably don't want the numerator and denominator to be the same measure.
426
- Do not use another metric for the numerator or denominator. You should use measures present in a data source.
427
- The numerator of the metric if it is a ratio metric. It should be a measure.
428
- """
429
- denominator: builtins.str
430
- """The denominator of the metric if it is a ratio metric. It should be a measure."""
431
- type: global___MetricType.ValueType
432
- """The type of the metric, e.g. MEASURE_PROXY, CUMULATIVE, RATIO, etc.
433
- If the type is MEASURE_PROXY, the name of the metric must match the measure name in the expression
434
- """
435
- window: builtins.str
436
- """The window of the metric if it is a cumulative metric."""
437
- grain_to_date: builtins.str
438
- """The grain of the metric if it is a cumulative metric."""
439
- value_type: global___MetricValueType.ValueType
440
- """The value type of the metric, e.g. INTEGER, FLOAT, etc.
441
- Always set this field to METRIC_VALUE_TYPE_UNKNOWN = 0
442
- """
443
- display_name: builtins.str
444
- is_numeric: builtins.bool
445
- """If the metric is numeric or not."""
446
- @property
447
- def measures(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
448
- """The measures of the metric.
449
- If type is MEASURE_PROXY, then this should be a list of exactly one measure.
450
- It should be included only measures that are defined in a data source.
451
- Two metrics of type MEASURE_PROXY cannot refer to the same measure.
452
- """
453
-
454
- def __init__(
455
- self,
456
- *,
457
- id: builtins.str = ...,
458
- name: builtins.str = ...,
459
- description: builtins.str = ...,
460
- expression: builtins.str = ...,
461
- view_id_of_table: builtins.str = ...,
462
- table_name: builtins.str = ...,
463
- measures: collections.abc.Iterable[builtins.str] | None = ...,
464
- numerator: builtins.str = ...,
465
- denominator: builtins.str = ...,
466
- type: global___MetricType.ValueType = ...,
467
- window: builtins.str = ...,
468
- grain_to_date: builtins.str = ...,
469
- value_type: global___MetricValueType.ValueType = ...,
470
- display_name: builtins.str = ...,
471
- is_numeric: builtins.bool = ...,
472
- ) -> None: ...
473
- def HasField(self, field_name: typing.Literal["cumulative_process", b"cumulative_process", "grain_to_date", b"grain_to_date", "window", b"window"]) -> builtins.bool: ...
474
- def ClearField(self, field_name: typing.Literal["cumulative_process", b"cumulative_process", "denominator", b"denominator", "description", b"description", "display_name", b"display_name", "expression", b"expression", "grain_to_date", b"grain_to_date", "id", b"id", "is_numeric", b"is_numeric", "measures", b"measures", "name", b"name", "numerator", b"numerator", "table_name", b"table_name", "type", b"type", "value_type", b"value_type", "view_id_of_table", b"view_id_of_table", "window", b"window"]) -> None: ...
475
- def WhichOneof(self, oneof_group: typing.Literal["cumulative_process", b"cumulative_process"]) -> typing.Literal["window", "grain_to_date"] | None: ...
476
-
477
- global___Metric = Metric
478
-
479
- @typing.final
480
- class DateStrRange(google.protobuf.message.Message):
481
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
482
-
483
- START_DATE_FIELD_NUMBER: builtins.int
484
- END_DATE_FIELD_NUMBER: builtins.int
485
- start_date: builtins.str
486
- """Start date in the format YYYY-MM-DD."""
487
- end_date: builtins.str
488
- """End date in the format YYYY-MM-DD."""
489
- def __init__(
490
- self,
491
- *,
492
- start_date: builtins.str = ...,
493
- end_date: builtins.str = ...,
494
- ) -> None: ...
495
- def ClearField(self, field_name: typing.Literal["end_date", b"end_date", "start_date", b"start_date"]) -> None: ...
496
-
497
- global___DateStrRange = DateStrRange
498
-
499
- @typing.final
500
- class QueryArgs(google.protobuf.message.Message):
501
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
502
-
503
- WHERE_CLAUSE_FIELD_NUMBER: builtins.int
504
- GROUP_BY_COLUMNS_FIELD_NUMBER: builtins.int
505
- METRICS_EXPRESSION_FIELD_NUMBER: builtins.int
506
- LIMIT_FIELD_NUMBER: builtins.int
507
- ORDER_BY_FIELD_NUMBER: builtins.int
508
- DATE_WHERE_CLAUSE_FIELD_NUMBER: builtins.int
509
- METRICS_FIELD_NUMBER: builtins.int
510
- HAVING_CLAUSE_FIELD_NUMBER: builtins.int
511
- INCOMPATIBLE_METRICS_FIELD_NUMBER: builtins.int
512
- INCOMPATIBLE_DIMENSIONS_FIELD_NUMBER: builtins.int
513
- DATE_RANGES_FIELD_NUMBER: builtins.int
514
- SQL_EXPLANATION_FIELD_NUMBER: builtins.int
515
- LEVEL_FIELD_NUMBER: builtins.int
516
- TIME_INCREMENT_FIELD_NUMBER: builtins.int
517
- MAIN_DATA_SOURCE_NAME_FIELD_NUMBER: builtins.int
518
- where_clause: builtins.str
519
- """This is the where clause of the generated sql."""
520
- limit: builtins.str
521
- """This is the LIMIT clause of the generated sql."""
522
- date_where_clause: builtins.str
523
- having_clause: builtins.str
524
- sql_explanation: builtins.str
525
- """The explanation of the generated sql."""
526
- level: builtins.str
527
- """level and time_increment are important info for Facebook Ads insights
528
- https://developers.facebook.com/docs/marketing-api/reference/ad-account/insights/
529
- """
530
- time_increment: builtins.str
531
- main_data_source_name: builtins.str
532
- @property
533
- def group_by_columns(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
534
- """This is the group by clause of the generated sql."""
535
-
536
- @property
537
- def metrics_expression(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
538
- """This is the metric expression of the generated sql."""
539
-
540
- @property
541
- def order_by(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
542
- """Column names for ordering. Descending order is indicated by a prepended '-'."""
543
-
544
- @property
545
- def metrics(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
546
- """The name of the metrics to be queried."""
547
-
548
- @property
549
- def incompatible_metrics(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
550
- """The list of metrics selected by the pipeline, but are incompatible for the request."""
551
-
552
- @property
553
- def incompatible_dimensions(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
554
- """The list of dimensions selected by the pipeline, but are incompatible for the request."""
555
-
556
- @property
557
- def date_ranges(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___DateStrRange]:
558
- """The date ranges to be queried."""
559
-
560
- def __init__(
561
- self,
562
- *,
563
- where_clause: builtins.str = ...,
564
- group_by_columns: collections.abc.Iterable[builtins.str] | None = ...,
565
- metrics_expression: collections.abc.Iterable[builtins.str] | None = ...,
566
- limit: builtins.str = ...,
567
- order_by: collections.abc.Iterable[builtins.str] | None = ...,
568
- date_where_clause: builtins.str = ...,
569
- metrics: collections.abc.Iterable[builtins.str] | None = ...,
570
- having_clause: builtins.str = ...,
571
- incompatible_metrics: collections.abc.Iterable[builtins.str] | None = ...,
572
- incompatible_dimensions: collections.abc.Iterable[builtins.str] | None = ...,
573
- date_ranges: collections.abc.Iterable[global___DateStrRange] | None = ...,
574
- sql_explanation: builtins.str = ...,
575
- level: builtins.str = ...,
576
- time_increment: builtins.str = ...,
577
- main_data_source_name: builtins.str = ...,
578
- ) -> None: ...
579
- def ClearField(self, field_name: typing.Literal["date_ranges", b"date_ranges", "date_where_clause", b"date_where_clause", "group_by_columns", b"group_by_columns", "having_clause", b"having_clause", "incompatible_dimensions", b"incompatible_dimensions", "incompatible_metrics", b"incompatible_metrics", "level", b"level", "limit", b"limit", "main_data_source_name", b"main_data_source_name", "metrics", b"metrics", "metrics_expression", b"metrics_expression", "order_by", b"order_by", "sql_explanation", b"sql_explanation", "time_increment", b"time_increment", "where_clause", b"where_clause"]) -> None: ...
580
-
581
- global___QueryArgs = QueryArgs
582
-
583
- @typing.final
584
- class DatasourceMetadata(google.protobuf.message.Message):
585
- DESCRIPTOR: google.protobuf.descriptor.Descriptor
586
-
587
- LOCATION_FIELD_NUMBER: builtins.int
588
- PROPERTY_ID_FIELD_NUMBER: builtins.int
589
- PROPERTY_NAME_FIELD_NUMBER: builtins.int
590
- location: global___DataSourceIntegration.ValueType
591
- property_id: builtins.str
592
- property_name: builtins.str
593
- def __init__(
594
- self,
595
- *,
596
- location: global___DataSourceIntegration.ValueType = ...,
597
- property_id: builtins.str = ...,
598
- property_name: builtins.str = ...,
599
- ) -> None: ...
600
- def ClearField(self, field_name: typing.Literal["location", b"location", "property_id", b"property_id", "property_name", b"property_name"]) -> None: ...
601
-
602
- global___DatasourceMetadata = DatasourceMetadata