6 Replies Latest reply: Aug 13, 2012 9:05 AM by Ramesh Reddy RSS

User defined data types

Sunil Varma Newbie

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?

  • 1. Re: User defined data types
    Ramesh Reddy Master

    Sunil,

     

    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.

     

    Ramesh..

  • 2. Re: User defined data types
    Nabeel Ahmed Newbie

    Hi Ramesh,

     

    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?

     

    regards,

    Nabeel

  • 3. Re: User defined data types
    Ramesh Reddy Master

    The attached VDB deployed  fine for me on the latest trunk version, is that one with the string or user defined type?

  • 4. Re: User defined data types
    Nabeel Ahmed Newbie

    Yes, it is with user-defined type named "Tag".

    I am using teiid-alpha2.

    I will upgrade to teiid-beta2 and give it a try.

  • 5. Re: User defined data types
    Nabeel Ahmed Newbie

    Hi Ramesh,

     

    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);

     

    and

     

    String type = rs.getString("TYPE_NAME")

     

    i always got the string instead of my defined type.

     

    regards,

     

    Nabeel

  • 6. Re: User defined data types
    Ramesh Reddy Master

    Nabeel,

     

    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.

     

    Thanks

     

    Ramesh..