Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

put connection name into schema-change email #921

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading