Query around Primary Key in Appian My SQL Database

Hi All,

 

I am working on version 18.1.

 

I have a few queries around Primary Key in Appian's MY SQL database:

 

1. In my MySQL database, if I want to create two columns as primary key i.e. if I want to create a composite key rather than making just one column as a primary key then how can I do that as in my data type Appian allows to create only one column as primary key though in XSD we can add two columns as primary key using @Id annotation. So I would like to know how can I achieve this or I can only create one column as primary key.

2. Also would like to know in which scenario do I get Unique Key Constraint violated error.

 

Thanks in advance!!

  Discussion posts and replies are publicly visible

Parents
  • Hi ,

    While creating a CDT based on a database table If the database table contains multiple primary keys, your data store will not publish and you cannot connect to the table. You will have the opportunity to remove additional primary keys or select another column as the primary key. Appian recommends that you choose only one column as the primary key.

    As an alternative solution as suggested by Ravalik,
    You can create additional column to save combination values of Primary Key1 and Primary Key2. And make that additional composite column as PK in your CDT.
    From DB side Additional Column should be Unique Key, PK is ( Primary Key1 and Primary Key2)
Reply
  • Hi ,

    While creating a CDT based on a database table If the database table contains multiple primary keys, your data store will not publish and you cannot connect to the table. You will have the opportunity to remove additional primary keys or select another column as the primary key. Appian recommends that you choose only one column as the primary key.

    As an alternative solution as suggested by Ravalik,
    You can create additional column to save combination values of Primary Key1 and Primary Key2. And make that additional composite column as PK in your CDT.
    From DB side Additional Column should be Unique Key, PK is ( Primary Key1 and Primary Key2)
Children