Search code examples
memgraphdb

Can I specify the labels in subclasses when using GQLAlchemy and Memgraph?


My issue is a large number of inherited labels. Sometimes there are quite a few superclasses and I don't want to inherit all labels. Is it possible, when using the Python OGM in GQLAlchemy, to specify the labels manually in subclasses?


Solution

  • You can specify labels when creating a class like this:

    class Streamer(User, labels=["Twitcher", "Streamer"]):
    

    There exist keyword labels and it should override class names.