Skip to content

Commit

Permalink
Fix uniqueness constraint with .auth.db.models.SqlUser.username
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Nov 1, 2023
1 parent 448a951 commit bc06315
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

## in progress
- Update to MLflow 2.8.0
- Fix uniqueness constraint with `mlflow.server.auth.db.models.SqlUser.username`.

## 2023-11-01 v2.7.1
- Fix uniqueness constraint with `SqlRegisteredModel.name`. Thanks, @andnig.
Expand Down
6 changes: 6 additions & 0 deletions mlflow_cratedb/patch/mlflow/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,18 @@ def polyfill_uniqueness_constraints():
TODO: Submit patch to `crate-python`, to be enabled by a
dialect parameter `crate_polyfill_unique` or such.
TODO: There are two more unique constraints defined on the MLflow data model.
- SqlExperimentPermission: "experiment_id", "user_id"
- SqlRegisteredModelPermission: "name", "user_id"
"""
from mlflow.store.model_registry.dbmodels.models import SqlRegisteredModel
from mlflow.store.tracking.dbmodels.models import SqlExperiment
from mlflow.server.auth.db.models import SqlUser

listen(SqlExperiment, "before_insert", check_uniqueness_factory(SqlExperiment, "name"))
listen(SqlRegisteredModel, "before_insert", check_uniqueness_factory(SqlRegisteredModel, "name"))
listen(SqlUser, "before_insert", check_uniqueness_factory(SqlUser, "username"))


def polyfill_refresh_after_dml():
Expand Down

0 comments on commit bc06315

Please sign in to comment.