Is there any provision within the Teiid designer to create user defined data types? We do have a requirement to model industry specific data (Explorartion & Production) and the generic built-in SQL data types are inadequate for this.
Is it possible to introduce user defined data types that we can then use from our abstract view models?
Yes, there is way to model the data types for your enterprise. In the Teiid Designer, create a project and then create a new XMLSchema file. Select the newly created XMLSchema file, right click and open with "Model Editor", this open up a Simple Data Type Editor, where you can model your data types based on the other types available.
Once you define the data types, you can model your models using the defined data types. However, note that they all have to eventually map to a Teiid runtime type (SQL Type) in the end. Also, the metadata collected in the data types editor is not fuly utilized at runtime, however you can query the meta models for data type information for anylytical purposes using Modeshape or System tables.
I have been successfully able to create user-defined type and used it in a column of the Table in View Model, but when i deploy the VDB, Teiid set it to INVALID.
if i use build-in type i.e string instead of my defined type, it works.
Please find the teiid project in attachments...
Am i missing anything ? any help?
TimeSeries.zip 25.1 K
I have tried it on Teiid-Beta2, it's working.
How can i find this type in Database metadata object in my java application?
i.e i am trying to get this type as follows:
// metadata is an object of DatabaseMetaData
ResultSet rs = metadata.getColumns(vdbname, modelName, tableName, null);
String type = rs.getString("TYPE_NAME")
i always got the string instead of my defined type.
Currently all the user defined types are mapped to the runtime data types in Teiid engine, thus you are seeing above through JDBC metadata. JDBC API does not provide extensions to show the user defined types, so it has to be some some extension Teiid needs to provide on top of the JDBC API to provide that. I do not think there is facility for that now.