5 Replies Latest reply on Oct 31, 2014 11:26 AM by blafond

    Create a source model using a DDL

    bpiepers

      According to the documentation it should be possible to create a source model using a DDL file. To my knowledge, a DDL file is nothing more than a file that contains statements with which a database can be re-created. For example statements like CREATE TABLE tableName (...)" etc. are in DDL files. I'm trying to import such a file and as a test, have created a very simple DDL with only one CREATE TABLE statement, containing only three fields. When trying to import that using the Teiid Designer it complaints about "1 instances of a DDL statement of type [ddl:ddlProblem] were foudn, but cannot be processed". It then only imports the table without the fields in that table.

       

      Are there any prerequisites to the file you import or is importing a DDL using the Teiid designer not possible after all?

        • 1. Re: Create a source model using a DDL
          van.halbert

          Bas,

           

          Can you paste in the contents of your DDL file?

           

          I just imported an H2 ddl file from the quoickstarts.  Example:

           

          CREATE TABLE status

          (

            VDBName varchar(50) not null,

            VDBVersion integer not null,

            SchemaName varchar(50) not null,

            Name varchar(256) not null,

            TargetSchemaName varchar(50),

            TargetName varchar(256) not null,

            Valid boolean not null,

            LoadState varchar(25) not null,

            Cardinality long,

            Updated timestamp not null,

            LoadNumber long not null,

            PRIMARY KEY (VDBName, VDBVersion, SchemaName, Name)

          );

           

           

          CREATE TABLE h2_stock_mat

          (

             product_id integer,

             SYMBOL varchar(16),

             PRICE decimal(20,4),

             COMPANY_NAME varchar(256)           

          );

           

           

          CREATE TABLE mat_stock_staging

          (

             product_id integer,

             SYMBOL varchar(16),

             PRICE decimal(20,4),

             COMPANY_NAME varchar(256)           

          );

          • 2. Re: Create a source model using a DDL
            rareddy

            Also how are you importing? Use "Import DDL File" option, the DDL file should be simple text file. Then you need to select the dialect of the SQL you are importing.

            • 3. Re: Create a source model using a DDL
              blafond

              See the DDL import section the the Designer's User Guide:  Chapter 5. Importers

              • 4. Re: Create a source model using a DDL
                bpiepers

                Hi all,

                 

                My simple example is from an SQL Server dialect and I think Teiid just doesn't support that:

                 

                CREATE TABLE BADGE_C (

                    ID varbinary(18) DEFAULT ((0)) NOT NULL,

                    CARDNO nvarchar(32) NOT NULL,

                    STAT_COD nchar(1) DEFAULT ('A'),  

                    PRIMARY KEY (CARDNO,ID)

                );

                 

                The quick start example from Van and the one Barry refers to give the same error message, by the way. However, if I use another very simple example like this one (very old, but okay) https://access.redhat.com/documentation/en-US/Red_Hat_JBoss_Developer_Studio/4.1/html-single/Teiid_Designer_User_Guide/i… it does work (so if I create a DDL with the contents of figure 3.3 in the manual of the link the import is successful but only if I manually choose dialect "Oracle"). Not sure yet why some simple examples work and why some don't...

                 

                I'm testing this on JDV 6 with Teiid Designer 8.3.3.

                 

                I am importing the way the documentation describes (see link from Barry).

                • 5. Re: Create a source model using a DDL
                  blafond

                  Teiid Designer utilizes Modeshape's DDL parsing framework and SQL Server DDL parsing (including unique datatypes like "varbinary" and "nvarchar") is not yet supported. I'd suggest logging a JIRA against ModeShape: ModeShape - JBoss Issue Tracker