CertSafari
    Snowflake SnowPro Advanced: Data Scientist (DSA-C03)· Lessons

    Domain 4 · Lesson 16/16

    Snowflake Model Registry: versions, metadata, promotion and retraining

    Outline model lifecycle and validation tools.

    20 min read
    8.33% of exam
    6 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Log a model version with log_model and attach comments and metrics that can be queried to compare versions
    • Promote and roll back a model by moving the default version or an alias, without changing production SQL
    • Choose between the default version, aliases, tags and separate schemas for lifecycle management
    • Use object tags on models for governance reporting across schemas
    • Design an automated retraining job that logs a new version and moves the production pointer only after validation

    Key concept

    Production pointer — A model in the Snowflake Model Registry holds many versions that do not change once logged. Production code calls a pointer, either the default version or an alias, so promoting or rolling back a model means moving that pointer to another version. Nothing is redeployed.

    1.Logging a model version with its metadata

    The Snowflake Model Registry is where a trained Python model becomes a governed Snowflake object. Models are first-class schema-level objects, so any schema can act as a registry. Snowflake recommends a dedicated one such as ML.REGISTRY. You add a model by logging it with Registry.log_model. That call serializes the Python object and creates a model object in the schema.

    log_model always creates a version. The model object only comes into existence when its first version is logged. To add V2 or V3, you call log_model again with the same model_name and a new version_name. A model name plus version name must be unique in the schema. You cannot re-log improved weights under an existing version name such as V2 to swap them in quietly. Each retrained artifact gets a new version, and the old versions stay available for comparison or rollback.

    Logging version v1 with dependencies, a comment, an initial metric and sample input datapython
    mv = reg.log_model(clf,
                       model_name="my_model",
                       version_name="v1",
                       conda_dependencies=["scikit-learn"],
                       comment="My awesome ML model",
                       metrics={"score": 96},
                       sample_input_data=train_features,
                       task=task.Task.TABULAR_BINARY_CLASSIFICATION)

    Comments and metrics belong to the version. Set a version's comment through mv.comment, which mv.description is a synonym for. Record evaluation results with mv.set_metric, read them back with show_metrics, and remove one with delete_metric. A metric value can be anything JSON-serializable: a scalar accuracy, a dictionary, or a confusion matrix. Metric names do not have to be declared in advance, unlike tags. Metrics are stored as version metadata, capped at 100 KB per version. In SQL the same data is written with ALTER MODEL ... MODIFY VERSION ... SET METADATA.

    Scalar and dictionary metrics on a version; the dictionary also records which dataset was usedpython
    # scalar metric
    mv.set_metric("test_accuracy", test_accuracy)
    
    # hierarchical (dictionary) metric
    mv.set_metric("evaluation_info", {"dataset_used": "my_dataset", "accuracy": test_accuracy, "f1_score": f1_score})

    You can query these metrics across the whole registry. Models and their versions appear in INFORMATION_SCHEMA.MODEL_VERSIONS, and there is no separate models view. Once every version carries an accuracy metric, one query ranks all of them, with each version's owner, comment and functions alongside. In Python, m.show_versions() returns the same per-version detail as a DataFrame, including an is_default_version flag.

    Ranking every model version in a database by its recorded accuracysql
    SELECT
        catalog_name,
        schema_name,
        model_name,
        model_version_name,
        metadata:metric:accuracy AS accuracy,
        comment,
        owner,
        functions,
        created_on,
        last_altered_on
    FROM my_database.INFORMATION_SCHEMA.MODEL_VERSIONS
    ORDER BY accuracy DESC;

    A version's metrics show how well it scored, and lineage shows which data produced it. When ML Lineage is enabled, the registry records the connection between a version and its upstream data, including a frozen, versioned Dataset (see Freezing training data (Snowflake ML Datasets)). Six months later you can still trace version V2 to the exact snapshot it was trained on, even though the source table has changed every day since. Lineage can be explored from the Lineage tab on the artifact's page in Snowsight, from the lineage method in snowflake-ml-python, or in SQL with SNOWFLAKE.CORE.GET_LINEAGE. Only objects created after ML Lineage is enabled carry lineage information.

    Checkpoint 1 of 9· Fill the gap

    This call logs version v1 and records its evaluation score on that version. Which keyword argument fills the blank?

    mv = reg.log_model(clf,
                       model_name="my_model",
                       version_name="v1",
                       conda_dependencies=["scikit-learn"],
                       comment="My awesome ML model",
                        ? ={"score": 96},
                       sample_input_data=train_features,
                       task=task.Task.TABULAR_BINARY_CLASSIFICATION)

    Sources123

    2.The default version is the production pointer

    Every model has exactly one default version. Unqualified calls such as my_model!predict(...) resolve to it. The simplest lifecycle convention treats the default as production: production SQL never names a version, so it always runs whatever the default currently is. Logging V9 does not move the default. The newest version and the production version are separate until someone makes them the same.

    Promotion is a single statement. After a validated version clears your quality bar, ALTER MODEL my_model SET DEFAULT_VERSION = new_version; moves every unqualified caller to it, with no SQL edits and no redeployment. In Python, the equivalent is assigning a version name to m.default, for example m.default = "v2". To test a pre-release version before promoting it, call it by name with MODEL(my_model, new_version)!predict(...).

    Rollback uses the same statement. Suppose V5 became the default yesterday and precision has since dropped. If V4 is still registered, setting the default back to V4 restores the previous behaviour at once. Dropping the model and recreating it, or retraining under pressure, is slower and destroys the version history you need to compare V4 and V5. Version history has limits, though: a model can hold at most 1,000 versions, so pruning old ones with delete_version is a deliberate cleanup step.

    A model can never be without a default. When its first version is logged, that version becomes the default immediately. The default-version scheme therefore cannot express "no production version yet". The documented workaround is to log a first version that just throws an error and leave it as the default until a real version is ready.

    Calling a model and promoting it require different privileges (granting is covered in Granting access to registered models). A production role with USAGE can run warehouse inference, but it cannot see the model's artifacts. Changing the default version is managing the model's versions, and that is part of OWNERSHIP. A job or person who moves the pointer needs the owning role, not just the grant that lets them call the model.

    Checkpoint 2 of 9· Check yourself

    A nightly retraining job logs CHURN_MODEL V6, validates it, and then runs ALTER MODEL churn_model SET DEFAULT_VERSION = V6;. The job runs as PROD_ROLE, which was given GRANT USAGE ON MODEL churn_model. What must PROD_ROLE have for the promotion step to succeed?

    Checkpoint 3 of 9· Exam question

    A data scientist validated churn model version V3 against holdout data. Dozens of existing SQL jobs call CHURN_MODEL!PREDICT(...) without naming a version. Which action moves all of them to V3 with no SQL edits?

    Sources21

    3.Aliases for named lifecycle stages

    Aliases add named stages beyond production. An alias is a label that you attach to a single version, such as alpha, beta or production. Each alias can sit on only one version at a time. You can use an alias anywhere a version name is accepted, including MODEL(my_model, production)!predict(...) in SQL and m.version(...) in Python. A batch job that calls MODEL(FRAUD, PROD) uses a stable name, and data scientists can keep logging versions without affecting it until someone moves the alias.

    Promoting a version means moving the alias, and the documented pattern always clears before it sets. Because only one version can hold production, you unset the alias on the current holder (v1) before setting it on the new version. The new version, v2, is cleared as well, because it already carries a stage alias: it was labelled alpha when logged and moved to beta by the same unset-then-set pair. UNSET ALIAS names no alias, so it removes whatever label the version currently holds. The production alias then moves exactly like the default version: one metadata change, and every caller follows.

    Moving the production alias from v1 to v2; the second line clears v2's current beta alias before production is setsql
    ALTER MODEL my_model VERSION v1 UNSET ALIAS;
    ALTER MODEL my_model VERSION v2 UNSET ALIAS;
    ALTER MODEL my_model VERSION v2 SET ALIAS = production;

    Every model also has three system aliases. DEFAULT points at the default version. FIRST and LAST point at the oldest and newest versions by creation time. LAST is not a production pointer. A nightly job that calls MODEL(CHURN, LAST)!PREDICT(...) switches to any experimental version that is logged, without anyone promoting it. Your own alias names cannot reuse an existing version name or any of these system aliases.

    Checkpoint 4 of 9· Match them up

    Batch jobs for CHURN_MODEL can call a version through several aliases. Match each alias to the version it resolves to.

    Tap a term, then the definition that fits it.

    Sources12

    4.Choosing a lifecycle scheme by who promotes

    The registry supports four lifecycle schemes. The deciding question is which role has authority to promote. The default-version and alias schemes both assume the model owner makes that decision. Many organizations instead give promotion to a production engineering role that does not own the model. In that setup, a tag such as live_version holds the name of the production version. Tags are controlled by role-based access control, so the production role can manage the tag while data scientists keep ownership of the model.

    The four lifecycle schemes compared
    SchemeUse whenHow production calls the model
    Default versionThe owner decides, and you only need development and production stagesmy_model!predict(...)
    AliasesThe owner decides, and you track several stages such as alpha, beta and productionMODEL(my_model, production)!predict(...)
    TagsA role other than the owner promotes versionsRead live_version with SYSTEM$GET_TAG, then call MODEL(my_model, IDENTIFIER($live_version))
    Multiple schemasA non-owner promotes, and development and production must be strongly separatedCode calls only models in the production schema; versions are copied there when ready

    The tag scheme separates duties but costs an extra step. Each caller reads the tag with SYSTEM$GET_TAG, using MODULE as the domain for models, and then calls that version. If the owner can promote, an alias gives the same stable name without the extra lookup. Use tags when governance requires a different role to promote. A common mix is to manage alpha and beta with aliases and leave only the production move to engineering.

    Checkpoint 5 of 9· Check yourself

    Governance at your company says data scientists keep OWNERSHIP of FRAUD_MODEL, but only the PROD_ENG role may decide which version serves production. Both teams work in the same schema. Which lifecycle scheme fits?

    Checkpoint 6 of 9· Exam question

    A platform team wants batch scoring jobs to use a stable name for the approved fraud model while data scientists keep logging new versions. Which design fits Snowflake Model Registry best?

    Sources2

    5.Tagging models for governance

    Tags answer governance questions across a whole account. Metrics and comments describe one version. A tag is a schema-level object that you assign to other objects as a key with a string value. One tag can be applied to models, tables and warehouses, and its assignments can be queried later for auditing and reporting. Tags on a model record its purpose, algorithm, training data set or lifecycle stage.

    Tags are defined first and then assigned. Every tag name must be created with CREATE TAG before it can be set, which requires the CREATE TAG privilege on the schema. Setting a tag on an object requires APPLY TAG. To keep values consistent, ALLOWED_VALUES restricts a tag to a fixed list. A misspelt value is rejected instead of silently creating a new category that your reports would miss.

    A tag restricted to approved valuessql
    CREATE TAG cost_center ALLOWED_VALUES 'finance', 'engineering';

    On a model, the tag belongs to the model object, not to a version. log_model adds a version and creates the model only when it adds the first one. That is why you set tags after the first version is logged, with ALTER MODEL ... SET TAG in SQL or m.set_tag(...) in Python. Python also has show_tags, get_tag and unset_tag. Tags therefore suit facts about the model as a whole, such as "trained on customer PII". Aliases are labels on versions and do not suit those facts.

    Setting a tag on a model, using the tag's fully qualified name from another schemasql
    USE ROLE prod_role;
    
    ALTER MODEL model_database.model_schema.my_model
        SET TAG prod_db.prod_schema.live_version = 'V2';

    Reporting uses the tag reference views. ACCOUNT_USAGE.TAG_REFERENCES and the INFORMATION_SCHEMA.TAG_REFERENCES function list which objects carry which tag values. Their apply_method column shows whether each tag was set by hand or propagated. For a request like "list every model trained on PII and its owning team", tag those models with a data_sensitivity tag that has approved values, query the tag references, and join to the owner column of MODEL_VERSIONS or SHOW MODELS. Free-text comments searched with a regular expression cannot be validated. A session QUERY_TAG labels queries, and registry model objects never receive it.

    Checkpoint 7 of 9· Fill the gap

    PROD_ROLE does not own my_model. It records which version is live with a governed key–value pair on the model object, using a tag created in its own schema. Which keyword completes the statement?

    USE ROLE prod_role;
    
    ALTER MODEL model_database.model_schema.my_model
        SET  ?  prod_db.prod_schema.live_version = 'V2';

    Checkpoint 8 of 9· Exam question

    A governance team must list every registered model trained on customer PII across several schemas and report the owning team of each. Which approach is most appropriate?

    Sources145

    6.Automating retraining with a gated promotion

    Retraining becomes safe to automate when it never edits production code directly. Deciding when to retrain is covered in Retraining: when to trigger it and how to automate it. In registry terms, an automated job must do two things: log a new version, and move the production pointer only after that version passes validation. Snowflake tasks provide the scheduling. A task runs a SQL statement, including a stored procedure call, on a schedule or in response to a trigger such as new data arriving.

    A gated retraining procedure follows this sequence:

    1. Train on a frozen snapshot of the current data, so the new version's lineage points at a fixed Dataset version.
    2. Call log_model with a new, unique version_name. The current default keeps serving traffic.
    3. Score the new version on holdout data and record the results with set_metric.
    4. Compare its metrics with the current default's metrics, which you can query from MODEL_VERSIONS.
    5. Only if it wins, run ALTER MODEL ... SET DEFAULT_VERSION or move the production alias. Otherwise, leave the pointer alone.

    This sequence delivers what the registry is designed for: rolling out a new version without changing production code. A failed validation leaves production untouched, and a bad promotion that slips through is undone by moving the pointer back. The task's role must have the right privileges. Logging a version requires CREATE MODEL on the schema or ownership of the schema, and moving the default or an alias requires ownership of the model. A role with only USAGE can run predictions but cannot promote.

    Checkpoint 9 of 9· Put it in order

    Put the steps of a scheduled retraining task for CHURN_MODEL in order, so that production jobs calling churn_model!predict(...) only ever switch to a validated version.

    1. 1.Compare its metrics with the current default version's metrics in MODEL_VERSIONS
    2. 2.Score the new version on holdout data and record the results with set_metric
    3. 3.Log the result with log_model under a new, unique version_name while the current default keeps serving
    4. 4.If the new version wins, run ALTER MODEL ... SET DEFAULT_VERSION to it; otherwise leave the default alone
    5. 5.Train the model on a frozen, versioned snapshot of the current data

    Sources621

    Sources

    (6)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “To log additional versions of the model, call log_model again with the same model_name but a different version_name.”
      ↩︎ Logging a model version with its metadata
      “The combination of model name and version must be unique in the schema.”
      ↩︎ Logging a model version with its metadata
      “Maximum metadata (including metrics) of 100 KB”
      ↩︎ Logging a model version with its metadata
      “A given alias can be assigned to only one model version at a time.”
      ↩︎ Aliases for named lifecycle stages
      “Alias names you create must not be the same as any existing version name or alias in the model, including system aliases.”
      ↩︎ Aliases for named lifecycle stages
      “You must define the names of all tags (and potentially their possible values) first by using CREATE TAG.”
      ↩︎ Tagging models for governance
      “You cannot add tags to a model when it is added to the registry, because tags are attributes of the model”
      ↩︎ Tagging models for governance
      “To create a model, you must either own the schema where the model is created or have the CREATE MODEL privilege on it.”
      ↩︎ Automating retraining with a gated promotion
      “LAST refers to the newest version of the model by creation time.”
      ↩︎ Exam trap 2
      “Unlike tags, metric names and possible values do not need to be defined in advance.”
      ↩︎ Exam trap 4
      “Version of the model used when referring to the model without a version.”
      ↩︎ Prediction
      “LAST refers to the newest version of the model by creation time.”
      ↩︎ Checkpoint
    2. 2.
      “The view for models and their versions is INFORMATION_SCHEMA.MODEL_VERSIONS.”
      ↩︎ Logging a model version with its metadata
      “A model must always have a default version.”
      ↩︎ The default version is the production pointer
      “you promote a model version to production simply by setting it as the default”
      ↩︎ The default version is the production pointer
      “Roles with only USAGE cannot access the model code, weights, or other artifacts.”
      ↩︎ The default version is the production pointer
      “Later, to promote the new version to beta:”
      ↩︎ Aliases for named lifecycle stages
      “remove the production alias from the current production version, here v1, and apply it to the new version, here v2.”
      ↩︎ Aliases for named lifecycle stages
      “Tags are securable by role-based access control and are suitable for this separation of responsibility.”
      ↩︎ Choosing a lifecycle scheme by who promotes
      “The SQL domain of models, for use with SYSTEM$GET_TAG, is MODULE.”
      ↩︎ Choosing a lifecycle scheme by who promotes
      “How to roll out a new version of a model without any changes to production code.”
      ↩︎ Automating retraining with a gated promotion
      “you promote a model version to production simply by setting it as the default”
      ↩︎ Key concept
      “production code only ever calls the default version of the model.”
      ↩︎ Exam trap 1
      “Full control of the model, including managing model versions, accessing artifacts, and updating model metadata.”
      ↩︎ Exam trap 3
      “Full control of the model, including managing model versions, accessing artifacts, and updating model metadata.”
      ↩︎ Checkpoint
      “A role other than the model owner determines when to promote a model version from one lifecycle stage to the next.”
      ↩︎ Checkpoint
      “has cleared the quality bar, designate it as the default to mark it as the production version.”
      ↩︎ Checkpoint
    3. 3.
      “The SQL function SNOWFLAKE.CORE.GET_LINEAGE can be used to query lineage information similar to the Snowpark library.”
      ↩︎ Logging a model version with its metadata
      “Only objects created after the ML Lineage feature is enabled in your account contain lineage information.”
      ↩︎ Logging a model version with its metadata
    4. 4.
      “Users cannot assign a value to a tag unless the value is in the defined list.”
      ↩︎ Tagging models for governance
    5. 5.
      “The following views and functions include the apply_method column, which shows how a tag was associated with an object.”
      ↩︎ Tagging models for governance
      “you can query them to monitor usage on objects and facilitate data governance operations, such as auditing and reporting.”
      ↩︎ Tagging models for governance
    6. 6.
      “A task object runs a SQL statement, which can include calls to stored procedures.”
      ↩︎ Automating retraining with a gated promotion
      “Tasks can run on a schedule or based on a trigger that you define, such as the arrival of data.”
      ↩︎ Automating retraining with a gated promotion

    Ready to test yourself?

    Practise the 30 questions on this subdomain.

    Spotted a mistake, or was something unclear? Tell us.