Skip to content

notify

Unified notification dispatcher for Snowpark Stored Procedures.

Routes a single notify() call to one or more channels: Email (via SYSTEM$SEND_EMAIL), Microsoft Teams Adaptive Cards, or Slack block messages.

All requests imports are lazy — the module is importable without requests installed.

Channel

Bases: str, Enum

Supported notification channels.

Source code in src/pinky_connect/notify.py
20
21
22
23
24
25
class Channel(str, Enum):
    """Supported notification channels."""

    EMAIL = "email"
    TEAMS = "teams"
    SLACK = "slack"

NotifyI18n

Bases: BaseModel

Built-in per-language labels. Pass a custom instance to notify() to override.

Attributes:

Name Type Description
fr NotifyLabels

French labels (default).

en NotifyLabels

English labels.

Source code in src/pinky_connect/notify.py
38
39
40
41
42
43
44
45
46
47
class NotifyI18n(BaseModel):
    """Built-in per-language labels. Pass a custom instance to ``notify()`` to override.

    Attributes:
        fr: French labels (default).
        en: English labels.
    """

    fr: NotifyLabels = NotifyLabels(subject_prefix="[ALERTE]")
    en: NotifyLabels = NotifyLabels(subject_prefix="[ALERT]")

NotifyLabels

Bases: BaseModel

Label set for one language used in notification templates.

Attributes:

Name Type Description
subject_prefix str

Bracketed prefix prepended to the email subject line.

Source code in src/pinky_connect/notify.py
28
29
30
31
32
33
34
35
class NotifyLabels(BaseModel):
    """Label set for one language used in notification templates.

    Attributes:
        subject_prefix: Bracketed prefix prepended to the email subject line.
    """

    subject_prefix: str

NotifyResult

Bases: BaseModel

Result returned by :func:notify.

Attributes:

Name Type Description
channel Channel

The channel that was used.

success bool

Whether the notification was delivered without error.

status_code int | None

HTTP status code from the downstream API, if applicable.

error str | None

Error message if success is False.

Source code in src/pinky_connect/notify.py
50
51
52
53
54
55
56
57
58
59
60
61
62
63
class NotifyResult(BaseModel):
    """Result returned by :func:`notify`.

    Attributes:
        channel: The channel that was used.
        success: Whether the notification was delivered without error.
        status_code: HTTP status code from the downstream API, if applicable.
        error: Error message if *success* is ``False``.
    """

    channel: Channel
    success: bool
    status_code: int | None = None
    error: str | None = None

generate_html(subject, body, *, i18n=None, lang='fr')

Render a branded HTML email body.

Parameters:

Name Type Description Default
subject str

Email subject line, used as the H1 heading.

required
body str

Plain-text or Markdown content rendered inside the email.

required
i18n NotifyI18n | None

Label overrides. Defaults to :class:NotifyI18n built-in labels.

None
lang str

ISO-639-1 language code selecting the active :class:NotifyLabels.

'fr'

Returns:

Type Description
str

A self-contained HTML string suitable for SYSTEM$SEND_EMAIL.

Source code in src/pinky_connect/notify.py
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
def generate_html(
    subject: str,
    body: str,
    *,
    i18n: NotifyI18n | None = None,
    lang: str = "fr",
) -> str:
    """Render a branded HTML email body.

    Args:
        subject: Email subject line, used as the H1 heading.
        body: Plain-text or Markdown content rendered inside the email.
        i18n: Label overrides. Defaults to :class:`NotifyI18n` built-in labels.
        lang: ISO-639-1 language code selecting the active :class:`NotifyLabels`.

    Returns:
        A self-contained HTML string suitable for ``SYSTEM$SEND_EMAIL``.
    """
    raise NotImplementedError("pending migration from _BACKUP/snowflake-kit-connect-bak")

notify(channel, *, subject, body, recipients=None, webhook_url=None, i18n=None, lang='fr', **extra)

Send a notification to the specified channel.

Parameters:

Name Type Description Default
channel Channel | str

Target channel — email, teams, or slack.

required
subject str

Notification title / subject line.

required
body str

Main message content.

required
recipients list[str] | None

Email addresses (required when channel is email).

None
webhook_url str | None

Incoming webhook URL (required for teams and slack).

None
i18n NotifyI18n | None

Label overrides. Defaults to :class:NotifyI18n built-in labels.

None
lang str

ISO-639-1 language code selecting the active :class:NotifyLabels.

'fr'
**extra Any

Channel-specific overrides forwarded to the underlying sender.

{}

Returns:

Name Type Description
A NotifyResult

class:NotifyResult describing delivery outcome.

Source code in src/pinky_connect/notify.py
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
def notify(
    channel: Channel | str,
    *,
    subject: str,
    body: str,
    recipients: list[str] | None = None,
    webhook_url: str | None = None,
    i18n: NotifyI18n | None = None,
    lang: str = "fr",
    **extra: Any,
) -> NotifyResult:
    """Send a notification to the specified channel.

    Args:
        channel: Target channel — ``email``, ``teams``, or ``slack``.
        subject: Notification title / subject line.
        body: Main message content.
        recipients: Email addresses (required when *channel* is ``email``).
        webhook_url: Incoming webhook URL (required for ``teams`` and ``slack``).
        i18n: Label overrides. Defaults to :class:`NotifyI18n` built-in labels.
        lang: ISO-639-1 language code selecting the active :class:`NotifyLabels`.
        **extra: Channel-specific overrides forwarded to the underlying sender.

    Returns:
        A :class:`NotifyResult` describing delivery outcome.
    """
    raise NotImplementedError("pending migration from _BACKUP/snowflake-kit-connect-bak")