Skip to content

Cannot import MutableModelBase #2

Description

@ejm4567

Hi,

I was trying to use MutableModelBase as a parent class for my model and I am unable to import it from sqlalchemy_mutable.

Looking in both the constructor and model_shell.py I don't see MutableModelBase anywhere.

Here's my model:

import os, json
from datetime import datetime
from flask_appbuilder import Model
from flask_sqlalchemy import SQLAlchemy
import sqlalchemy.types as types
from sqlalchemy import create_engine
from sqlalchemy.sql import func
from sqlalchemy import Column, Integer, String, ForeignKey, DateTime
from sqlalchemy.orm import relationship, Mapped, declarative_base
from sqlalchemy.ext.hybrid import hybrid_property
from sqlalchemy.types import TypeDecorator, TEXT, VARCHAR
from sqlalchemy import MetaData
from sqlalchemy_mutable import Mutable, MutableModelBase

...

class VSODataSets(MutableModelBase, db.Model):
      __tablename__ = 'datasets'

      id: Mapped[int]                    = db.Column("id", db.Integer, primary_key=True)
      provider: Mapped[str]         = db.Column("provider", ForeignKey(VSORegistry.provider), index=True)
      datasets                               = db.Column("datasets", MutableList)

      created_on    = db.Column("created_on", db.DateTime(timezone=True), default=func.now())
      last_modified = db.Column("last_modified", db.DateTime(timezone=True), default=func.now(), onupdate=func.now())

      def __init__(self):
         self.datasets = Mutable()

Also, in your example is MutableType a placeholder for MutableDict, MutableList or MutableSet for example?

Thanks,

--Ed

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions