Skip to content

Commit

Permalink
Update experiment export query to include feature ids and branch feat…
Browse files Browse the repository at this point in the history
…ure config values (#4477)

* Update experiment export query to include feature ids and branch feature
config value.

* Add view skip for broken view

* add skip to dry run as well
  • Loading branch information
quiiver authored and kik-kik committed Nov 14, 2023
1 parent 64da43e commit 659dd58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 2 additions & 0 deletions bqetl_project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dry_run:
function: https://us-central1-moz-fx-data-shared-prod.cloudfunctions.net/bigquery-etl-dryrun
skip:
# Access Denied
- sql/moz-fx-data-shared-prod/ads/nt_visits_to_sessions_conversion_factors_daily/view.sql
- sql/moz-fx-data-shared-prod/account_ecosystem_derived/ecosystem_client_id_lookup_v1/query.sql
- sql/moz-fx-data-shared-prod/account_ecosystem_derived/desktop_clients_daily_v1/query.sql
- sql/moz-fx-data-shared-prod/account_ecosystem_restricted/ecosystem_client_id_deletion_v1/query.sql
Expand Down Expand Up @@ -362,6 +363,7 @@ view:
# tests
- sql/moz-fx-data-test-project/test/simple_view/view.sql
# Access Denied
- sql/moz-fx-data-shared-prod/ads/nt_visits_to_sessions_conversion_factors_daily/view.sql
- sql/moz-fx-data-shared-prod/telemetry/experiment_enrollment_cumulative_population_estimate/view.sql
- sql/moz-fx-data-shared-prod/mlhackweek_search/events/view.sql
- sql/moz-fx-data-shared-prod/regrets_reporter_ucs/deletion_request/view.sql
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Branch:

slug: str
ratio: int
features: Optional[dict]


@attr.s(auto_attribs=True)
Expand All @@ -61,6 +62,7 @@ class Experiment:
targeting: str
targeted_percent: float
namespace: Optional[str]
feature_ids: List[str]


def _coerce_none_to_zero(x: Optional[int]) -> int:
Expand Down Expand Up @@ -113,7 +115,8 @@ def from_dict(cls, d) -> "ExperimentV1":
def to_experiment(self) -> "Experiment":
"""Convert to Experiment."""
branches = [
Branch(slug=variant.slug, ratio=variant.ratio) for variant in self.variants
Branch(slug=variant.slug, ratio=variant.ratio, features=None)
for variant in self.variants
]
control_slug = None

Expand Down Expand Up @@ -141,6 +144,7 @@ def to_experiment(self) -> "Experiment":
targeting="",
targeted_percent=float(self.population_percent) / 100.0,
namespace=None,
feature_ids=[],
)


Expand All @@ -160,6 +164,7 @@ class ExperimentV6:
channel: str
targeting: str
bucketConfig: dict
featureIds: list[str]

@classmethod
def from_dict(cls, d) -> "ExperimentV6":
Expand All @@ -173,7 +178,9 @@ def from_dict(cls, d) -> "ExperimentV6":
)
converter.register_structure_hook(
Branch,
lambda b, _: Branch(slug=b["slug"], ratio=b["ratio"]),
lambda b, _: Branch(
slug=b["slug"], ratio=b["ratio"], features=b["features"]
),
)
return converter.structure(d, cls)

Expand Down Expand Up @@ -205,6 +212,7 @@ def to_experiment(self) -> "Experiment":
targeting=self.targeting,
targeted_percent=self.bucketConfig["count"] / self.bucketConfig["total"],
namespace=self.bucketConfig["namespace"],
feature_ids=self.featureIds,
)


Expand Down Expand Up @@ -278,6 +286,7 @@ def main():
fields=[
bigquery.SchemaField("slug", "STRING"),
bigquery.SchemaField("ratio", "INTEGER"),
bigquery.SchemaField("features", "JSON"),
],
),
bigquery.SchemaField("app_id", "STRING"),
Expand All @@ -286,6 +295,7 @@ def main():
bigquery.SchemaField("targeting", "STRING"),
bigquery.SchemaField("targeted_percent", "FLOAT"),
bigquery.SchemaField("namespace", "STRING"),
bigquery.SchemaField("feature_ids", "STRING", mode="REPEATED"),
)

job_config = bigquery.LoadJobConfig(
Expand Down

0 comments on commit 659dd58

Please sign in to comment.