Feature Engine
Declare owners and metadata for features.
Features can capture metadata to inform
alerting, monitoring, and discovery.
By default, features are created as any type-annotated
variable of a class decorated with @features.
However, you can also assign these variables to the
result of the chalk.features.feature(...) function
to provide metadata.
Descriptions are parsed from the comments preceding
the feature definition. For example, you can document a
fraud_score feature with information about the values
as follows:
@features
class User:
# 0 to 100 score indicating an identity match.
# Low scores indicate safer users
fraud_score: float
...
You can alternatively provide a description of a feature directly in the code. The following example is equivalent to explicitly providing the description as above:
@features
class User:
fraud_score: float = feature(description="""
0 to 100 score indicating an identity match.
Low scores indicate safer users
""")
...
If both an explicit description and a comment are present,
the description is set to the explicit value from
feature(description=...).
You can programmatically access the description for a feature
with the description(...) function:
from chalk.features import description
print(description(User.fraud_score))
You can also specify which person or group is responsible for an individual feature. The owner tag is available in Chalk’s web portal. Alerts that do not otherwise have an owner are assigned to the owner of the monitored feature. Owners are parsed from the source code. For example:
@features
class User:
full_name: str
# :owner: katherine.johnson@nasa.gov
fraud_score: float
...
You can instead specify an owner via a keyword argument to
feature().
For example:
@features
class User:
full_name: str
fraud_score: float = feature(owner="katherine.johnson@nasa.gov")
...
An owner can also be assigned to every feature in a namespace via a keyword argument to @features:
@features(owner="katherine.johnson@nasa.gov")
class User:
full_name: str
fraud_score: float
# :owner: annie.easley@nasa.gov
email: str
...
Here, User.full_name and User.fraud_score
assume the owner katherine.johnson@nasa.gov.
However, User.email, which specifies an owner at the feature level,
assumes the owner annie.easley@nasa.gov.
You can programmatically access the owner of a feature
with the owner(...) function:
from chalk.features import owner
assert owner(User.email) == "annie.easley@nasa.gov"
Tags are a way of adding metadata to features for use in filtering, aggregations, and visualizations. Feature tags do not select resolvers or datasource routes. When used with RBAC, they control access through a permission-tag mapping rather than routing. For example, you can use tags to assign features to a team and find all features for a given team.
@features
class User:
# :tags: team:identity, priority:high
fraud_score: float
...
Alternatively, you can specify tags via explicit construction:
@features
class User:
fraud_score: float = feature(tags=[
"team:identity",
"priority:high",
])
...
As with the owner property, tags can be assigned to all features in a namespace:
@features(tags="group:risk")
class User:
fraud_score: float
# :tags: pii
email: str
...
Here, User.fraud_score inherits the tag group:risk.
The feature User.email also inherits this tag
in addition to the tag pii.
You can programmatically access the tags for a feature
with the tags(...) function:
from chalk.features import tags
assert tags(User.email) == ["pii", "group:risk"]
Chalk provides two ways to search. Global search matches the text you type against names. Chalk Assistant provides semantic search: you describe what you want in plain language, and the Assistant finds it, even when you do not know the exact name. For example, you can search for “user risk features” or “features updated last week” or “features owned by data team”.
Press Cmd+K (Mac) or Ctrl+K (Windows/Linux) anywhere in the Chalk dashboard, or select the search bar in the header, to open global search. Each tab searches one kind of result:
To use semantic search, send your query from global search to Chalk Assistant:
Shift+Enter. Global search switches to a prompt box that contains your query.Enter to send it. Chalk Assistant opens in the sidebar and answers.In the prompt box, Shift+Enter adds a new line and Esc returns to search. Once you type a query, the footer of the search window shows a Shift ↵ Ask AI hint. The hint and the shortcut appear only when Chalk Assistant is enabled for your environment. See Enabling Chalk Assistant for setup.
Chalk tracks how every feature produced by a SQL File Resolver is computed, including which datasource and table supplied the raw data, which resolver transformed it, and which queries consume it. See Data Lineage for the full reference.