Same database view in different environments generates different cdt

Certified Senior Developer

I have a View in the Appian Cloud database with a column that concatenates some values, lets call it column "CODES".

I started in our dev environments creating a CDT from Table/View and verifying the datastore.

I then did a distribution to the test environment of the CDT, View and Datastore. While verifying in test environment I get an error that CODES is not a MEDIUMTEXT, it's a LONGTEXT. Not knowing what to do I try to create the CDT in test environment and actually the generated CDT in this environment is different that the one that was generated in dev, even though the database view is the same.

Any suggestions on how to solve this issue? The thing is that I don't know in a production environment which datatype Appian will choose, and I don't want to create objects manually in production, I shouldn't even be able to.

Thank you!

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer

    Did you check the source table's column data type is MEDIUMTEX or LONGTEXT in test environment? If the tables are identical between all environments the view will be of identical structure too. 

  • 0
    Certified Senior Developer
    in reply to Harsha Sharma

    This is what I see when trying to update the CDT:

    wrong column type encountered in column [ABI] in table [`XXXXXX`]; found [longtext (Types#LONGVARCHAR)], but expecting [mediumtext (Types#VARCHAR)]

    This is what i see in MariaDB/PhpMyAdmin:

    # Name Type Collation Attributes Null Default Comments Extra
    1 xxxx int(11) No 0
    2 xxxxx varchar(255) utf8mb3_general_ci Yes NULL
    11 ABI mediumtext utf8mb3_general_ci Yes NULL

    I don't know where Appian is getting longtext/longvarchar from.

  • 0
    Certified Lead Developer
    in reply to Chiara Gambone

    Can you post that PhpMyAdmin structure from both environments?

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Stefan do you mean the code that generates the View or just the resulting structure? In any case, they appear exactly the same in PhpMyAdmin:

    DEV ENVIRONMENT: 

    # Name Type Collation Attributes Null Default Comments Extra
    1 ID int(11) No 0
    2 xx varchar(255) utf8mb3_general_ci Yes NULL
    3 xx varchar(255) utf8mb3_general_ci Yes NULL
    4 xx varchar(255) utf8mb3_general_ci Yes NULL
    5 xx int(11) Yes NULL
    6 xx int(11) Yes NULL
    7 xx int(11) Yes NULL
    8 xx int(11) Yes NULL
    9 xx int(11) Yes NULL
    10 xx date Yes NULL
    11 ABI mediumtext utf8mb3_general_ci Yes NULL

    TEST ENVIRONMENT:

    # Name Type Collation Attributes Null Default Comments Extra
    1 ID int(11) No 0
    2 xx varchar(255) utf8mb3_general_ci Yes NULL
    3 xx varchar(255) utf8mb3_general_ci Yes NULL
    4 xx varchar(255) utf8mb3_general_ci Yes NULL
    5 xx int(11) Yes NULL
    6 xx int(11) Yes NULL
    7 xx int(11) Yes NULL
    8 xx int(11) Yes NULL
    9 xx int(11) Yes NULL
    10 xx date Yes NULL
    11 ABI mediumtext utf8mb3_general_ci Yes NULL

    When I import you can see it recognizes "longtext"

  • 0
    Certified Lead Developer
    in reply to Chiara Gambone

    Are you sure they are long text in both environnements?

  • 0
    Certified Senior Developer
    in reply to Mathieu Drouin

    How do you mean  ? As you can see the Database shows one thing, but then Appian shows another and I cannot reconcile the two

  • 0
    Certified Lead Developer
    in reply to Chiara Gambone

    OK, and the XSD of the CDT on both environments?

  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Sorry everyone for not replying but my account is being flagged for spam at each comment i make. I'm afraid of being banned so I will just add this.

    These are the XSD of the two environments in order

    <xsd:element name="abi" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="ABI", columnDefinition="LONGTEXT")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    <xsd:element name="abi" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="ABI", columnDefinition="LONGTEXT")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    In one case I can validate the Data Store without error, in the other case 

    found [mediumtext (Types#LONGVARCHAR)], but expecting [longtext (Types#VARCHAR)] (APNX-2-4056-000)

    But I have know noticed that even with this error in the Data Store, the query entity on this View works, so I won't touch it anymore and hope that in production environment it works.

    I have tried dropping the view and recreating it, deleting the xsd and importing again, it's not changing.

Reply
  • 0
    Certified Senior Developer
    in reply to Stefan Helzle

    Sorry everyone for not replying but my account is being flagged for spam at each comment i make. I'm afraid of being banned so I will just add this.

    These are the XSD of the two environments in order

    <xsd:element name="abi" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="ABI", columnDefinition="LONGTEXT")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    <xsd:element name="abi" nillable="true" type="xsd:string">
    <xsd:annotation>
    <xsd:appinfo source="appian.jpa">@Column(name="ABI", columnDefinition="LONGTEXT")</xsd:appinfo>
    </xsd:annotation>
    </xsd:element>

    In one case I can validate the Data Store without error, in the other case 

    found [mediumtext (Types#LONGVARCHAR)], but expecting [longtext (Types#VARCHAR)] (APNX-2-4056-000)

    But I have know noticed that even with this error in the Data Store, the query entity on this View works, so I won't touch it anymore and hope that in production environment it works.

    I have tried dropping the view and recreating it, deleting the xsd and importing again, it's not changing.

Children