el3ctron
el3ctron

Reputation: 99

How do I list classes with a SQL query on OrientDB?

On orientdb documentation I found a command like LIST CLASSES or CLASSES that returns a list of current classes in the database -->

    orientdb> LIST CLASSES

    CLASSES
    -------------+------+-------------+-----------
     NAME        |  ID  | CLUSTERS    | ELEMENTS  
    -------------+------+-------------+-----------
     Person      |    0 | person      |         7 
     Animal      |    1 | animal      |         5 
     AnimalRace  |    2 | AnimalRace  |         0 
     AnimalType  |    3 | AnimalType  |         1 
     OrderItem   |    4 | OrderItem   |         0 
     Order       |    5 | Order       |         0 
     City        |    6 | City        |         3 
    -------------+------+-------------+-----------
     TOTAL                                     16 
    -----------------------------------------------
    .

I am trying to load all database with select * from V and later trying to filter all results by @class, but I don't think this is a good idea when the database gets big...

Is there a way to get the same result with a SQL query?

Upvotes: 2

Views: 3245

Answers (1)

Luigi Dell'Aquila
Luigi Dell'Aquila

Reputation: 2814

Try the following

SELECT expand(classes) from metadata:schema

Upvotes: 8

Related Questions