I have embedded Teiid 12.3 in a Spring Boot application. I want to get into the metadata of my VDB in order to generate a diagram using graphviz-java. I assume that if I have a org.teiid.metadata.Table
object, I can call getIncomingObjects()
to get references to tables that table depends on. I just can't figure out how to navigate from the EmbeddedServer
to the Table
objects.
I looked into using the administration API available via EmbeddedServer.getAdmin()
. From there, I can call getVDBs()
, and from there I can navigate down to getModels()
, but below that level there is only the model source via getSourceMetadataText()
. I also tried subclassing EmbeddedServer
to make getVDBRepository()
public. I can call getVDBRepository()*.getModels()
, but it returns the same Model
objects only get me access to the source definition of the models, not the runtime metadata model.
I tried getVDBRepository().getSystemStore()
and VDBRepository.getODBCStore()
, but those MetadataStore
s are not for the VDB I have deployed.
I haven't found any examples by Google, Teeid JIRA, Teiid forum, or StackOverflow to help me.
Take look at [1] the getSchema
method on Admin
API, this method returns the string form of the metadata, however you can grab Schema
object for object form. If you do not want that way, Teiid also exposes system catalog using many SYS
tables, you can issue SQL queries to grab the metadata of schemas and schema items in a VDB. One for internal access, another is from external access.
BTW one of users created a dependency diagram tool that may be useful if you are trying to do something similar. See [2]. Let me know if you interested in pushing that further.
[1] https://github.com/teiid/teiid/blob/master/runtime/src/main/java/org/teiid/runtime/EmbeddedAdminImpl.java#L544-L557 [2] https://github.com/teiid/metadata-catalog-ui