Skip to content

Commit

Permalink
Create account aliases when ingesting an experiment from a manifest file
Browse files Browse the repository at this point in the history
  • Loading branch information
karlhigley committed Sep 4, 2024
1 parent 14ec332 commit 5331dd0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/poprox_storage/repositories/experiments.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def store_experiment(
for group in experiment.groups:
group.group_id = self._insert_expt_group(experiment_id, group)
for account in assignments.get(group.name, []):
self._insert_account_alias(dataset_id, account)

assignment = Assignment(
account_id=account.account_id, group_id=group.group_id
)
Expand Down Expand Up @@ -259,6 +261,17 @@ def _insert_expt_treatment(
commit=False,
)

def _insert_account_alias(self, dataset_id: UUID, account: Account) -> UUID | None:
return self._upsert_and_return_id(
self.conn,
self.tables["account_aliases"],
values={
"dataset_id": dataset_id,
"account_id": account.account_id,
},
commit=False,
)

def _insert_expt_assignment(
self,
assignment: Assignment,
Expand Down

0 comments on commit 5331dd0

Please sign in to comment.