How to "describe" a class, index, or other object in OrientDB SQL?

346 Views Asked by At

Essentially, what is the "opposite" of CREATE CLASS (or CREATE anything) in ODB SQL? Most/all other SQL/SQL-like databases provide a way to describe a database object in terms of the SQL command it takes to create it, but I can't find anything about this in the ODB docs. What does Studio use when you click on a class in the Schema Manager? What I'm ultimately looking for is a way to produce the CREATE command from an existing database object, using ODB SQL.

1

There are 1 best solutions below

2
On

OrientDB schema can be queried to obtain information about classes:

https://orientdb.com/docs/last/SQL.html#query-metadata

Information about classes:

select expand(classes) from metadata:schema

Information about a single class:

select expand(properties) from (
   select expand(classes) from metadata:schema
) where name = 'MyClassName'

Metadata about indexed could be obtained as well:

select expand(indexes) from metadata:indexmanager