Edit on GitHub

sqlmesh.core.user

 1import typing as t
 2from enum import Enum
 3
 4from sqlmesh.utils.pydantic import PydanticModel
 5
 6
 7class UserRole(str, Enum):
 8    """A role to associate the user with"""
 9
10    GATEKEEPER = "gatekeeper"
11    BOT = "bot"
12
13    @property
14    def is_gatekeeper(self) -> bool:
15        return self == UserRole.GATEKEEPER
16
17    @property
18    def is_bot(self) -> bool:
19        return self == UserRole.BOT
20
21
22class User(PydanticModel):
23    """SQLMesh user information that can be used for notifications"""
24
25    username: str
26    """The name to refer to the user"""
27    github_username: t.Optional[str] = None
28    """The github login username"""
29    slack_username: t.Optional[str] = None
30    """The slack username"""
31    email: t.Optional[str] = None
32    """The email for the user (full address)"""
33    roles: t.List[UserRole] = []
34    """List of roles to associate with the user"""
35
36    @property
37    def is_gatekeeper(self) -> bool:
38        """Indicates if this is a gatekeeper for PR approvals.
39        TODO: Users should be able to define this on a "per-project" level but that requires adding the concept of
40        "projects" to SQLMesh so making this a global config for now
41        """
42        return UserRole.GATEKEEPER in self.roles
43
44    @property
45    def is_bot(self) -> bool:
46        """Indicates if this is a CI/CD bot account. There should only be one of these per project"""
47        return UserRole.BOT in self.roles
class UserRole(builtins.str, enum.Enum):
 8class UserRole(str, Enum):
 9    """A role to associate the user with"""
10
11    GATEKEEPER = "gatekeeper"
12    BOT = "bot"
13
14    @property
15    def is_gatekeeper(self) -> bool:
16        return self == UserRole.GATEKEEPER
17
18    @property
19    def is_bot(self) -> bool:
20        return self == UserRole.BOT

A role to associate the user with

GATEKEEPER = <UserRole.GATEKEEPER: 'gatekeeper'>
BOT = <UserRole.BOT: 'bot'>
Inherited Members
enum.Enum
name
value
builtins.str
encode
replace
split
rsplit
join
capitalize
casefold
title
center
count
expandtabs
find
partition
index
ljust
lower
lstrip
rfind
rindex
rjust
rstrip
rpartition
splitlines
strip
swapcase
translate
upper
startswith
endswith
removeprefix
removesuffix
isascii
islower
isupper
istitle
isspace
isdecimal
isdigit
isnumeric
isalpha
isalnum
isidentifier
isprintable
zfill
format
format_map
maketrans
class User(sqlmesh.utils.pydantic.PydanticModel):
23class User(PydanticModel):
24    """SQLMesh user information that can be used for notifications"""
25
26    username: str
27    """The name to refer to the user"""
28    github_username: t.Optional[str] = None
29    """The github login username"""
30    slack_username: t.Optional[str] = None
31    """The slack username"""
32    email: t.Optional[str] = None
33    """The email for the user (full address)"""
34    roles: t.List[UserRole] = []
35    """List of roles to associate with the user"""
36
37    @property
38    def is_gatekeeper(self) -> bool:
39        """Indicates if this is a gatekeeper for PR approvals.
40        TODO: Users should be able to define this on a "per-project" level but that requires adding the concept of
41        "projects" to SQLMesh so making this a global config for now
42        """
43        return UserRole.GATEKEEPER in self.roles
44
45    @property
46    def is_bot(self) -> bool:
47        """Indicates if this is a CI/CD bot account. There should only be one of these per project"""
48        return UserRole.BOT in self.roles

SQLMesh user information that can be used for notifications

username: str

The name to refer to the user

github_username: Optional[str]

The github login username

slack_username: Optional[str]

The slack username

email: Optional[str]

The email for the user (full address)

List of roles to associate with the user

is_gatekeeper: bool

Indicates if this is a gatekeeper for PR approvals. TODO: Users should be able to define this on a "per-project" level but that requires adding the concept of "projects" to SQLMesh so making this a global config for now

is_bot: bool

Indicates if this is a CI/CD bot account. There should only be one of these per project

Inherited Members
pydantic.main.BaseModel
BaseModel
parse_obj
parse_raw
parse_file
from_orm
construct
copy
schema
schema_json
validate
update_forward_refs
sqlmesh.utils.pydantic.PydanticModel
Config
dict
json
missing_required_fields
extra_fields
all_fields
required_fields