2

I'm trying to create classes with pyorient driver but sometime if class exists I got class exists message. Is there a way to check whether class is exists or not in OrientDB python driver? Here is part of my sample code for class creation...

@classmethod
def create(cls):

    cls._cluster_id = OrientEngine.client.command("CREATE CLASS %s EXTENDS V" % cls.__name__)
    return cls._cluster_id
peak
  • 105,803
  • 17
  • 152
  • 177
hamidfzm
  • 4,595
  • 8
  • 48
  • 80

1 Answers1

7

Via SQL to check the existence of "OUser" class execute this:

SELECT FROM ( SELECT expand( classes ) FROM metadata:schema ) WHERE name = 'OUser'

Via Java API:

OClass cls = db.getMetadata().getSchema().getClass("OUser");
Lvca
  • 8,938
  • 2
  • 24
  • 25