Skip to content

Commit

Permalink
Merge pull request #921 from DalgoT4D/920-put-the-name-of-the-connect…
Browse files Browse the repository at this point in the history
…ion-into-the-schema-changes-email

put connection name into schema-change email
  • Loading branch information
Ishankoradia authored Dec 18, 2024
2 parents 038496f + 0b9da5c commit f36b58f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 3 additions & 2 deletions ddpui/celeryworkers/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,12 @@ def detect_schema_changes_for_org(org: Org):
if frontend_url.endswith("/"):
frontend_url = frontend_url[:-1]
connections_page = f"{frontend_url}/pipeline/ingest?tab=connections"
connection_name = connection_catalog["name"]
notify_org_managers(
org,
f"To the admins of {org.name},\n\nThis email is to let you know that"
" schema changes have been detected in your Dalgo sources.\n\nPlease"
f" visit {connections_page} and review the Pending Actions",
f' schema changes have been detected in your Dalgo sources for "{connection_name}".'
f"\n\nPlease visit {connections_page} and review the Pending Actions",
)
except Exception as err:
logger.error(err)
Expand Down
5 changes: 2 additions & 3 deletions ddpui/ddpairbyte/airbytehelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

import json
import os
from pathlib import Path
import yaml
from ninja.errors import HttpError
from pathlib import Path
from django.utils.text import slugify
from django.conf import settings
from django.db import transaction
from django.db.models import Prefetch, F, Window, Q
from django.db.models import F, Window, Q
from django.db.models.functions import RowNumber
from django.forms.models import model_to_dict

Expand Down Expand Up @@ -57,7 +57,6 @@
from ddpui.utils.helpers import (
generate_hash_id,
update_dict_but_not_stars,
map_airbyte_keys_to_postgres_keys,
get_schedule_time_for_large_jobs,
)
from ddpui.utils import secretsmanager
Expand Down
7 changes: 5 additions & 2 deletions ddpui/tests/core/test_celery_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,10 @@ def test_detect_schema_changes_for_org_send_schema_changes_email(
) as fetch_and_update_org_schema_changes_mock, patch(
"ddpui.celeryworkers.tasks.notify_org_managers"
) as notify_org_managers_mock:
fetch_and_update_org_schema_changes_mock.return_value = {"schemaChange": "breaking"}, None
fetch_and_update_org_schema_changes_mock.return_value = {
"schemaChange": "breaking",
"name": "CONN_NAME",
}, None
orguser.org = org_without_workspace
role = Role.objects.filter(slug="account-manager").first()
if role is None:
Expand All @@ -398,7 +401,7 @@ def test_detect_schema_changes_for_org_send_schema_changes_email(

notify_org_managers_mock.assert_called_once_with(
org_without_workspace,
f"To the admins of {org_without_workspace.name},\n\nThis email is to let you know that schema changes have been detected in your Dalgo sources.\n\nPlease visit {connections_page} and review the Pending Actions",
f'To the admins of {org_without_workspace.name},\n\nThis email is to let you know that schema changes have been detected in your Dalgo sources for "CONN_NAME".\n\nPlease visit {connections_page} and review the Pending Actions',
)


Expand Down

0 comments on commit f36b58f

Please sign in to comment.