<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/discussions/f/general/12695/query-around-primary-key-in-appian-my-sql-database</link><description>Hi All, 
 
 I am working on version 18.1. 
 
 I have a few queries around Primary Key in Appian&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56813?ContentTypeID=1</link><pubDate>Tue, 19 Jun 2018 03:14:23 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:582ad63c-6419-4cb6-b994-5293d406a158</guid><dc:creator>komalc3</dc:creator><description>Hi &lt;a href="/members/arikd398"&gt;arikd398&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
If you go by my earlier comments I have already tried the two primary keys thing whose screen shots I have attached above for reference.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56784?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 11:11:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ce83aa01-eca0-4a9d-9440-d5dedcf196e1</guid><dc:creator>arikd398</dc:creator><description> ,&lt;br /&gt;
&lt;br /&gt;
Even we tried to create XSD with two primary keys mapped with a particular table and we are getting the same error.&lt;br /&gt;
Even if it imports successfully while publishing it will again give the same error.&lt;br /&gt;
&lt;br /&gt;
So i am not sure how &lt;a href="/members/paragk998"&gt;paragk998&lt;/a&gt;  implemented that.&lt;br /&gt;
&lt;a href="/members/paragk998"&gt;paragk998&lt;/a&gt;  can you please help us with the underlying table structure for the same ?&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56781?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 10:35:25 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:bd790ebd-992f-480f-a035-dfb3d39da6a3</guid><dc:creator>komalc3</dc:creator><description>Hi &lt;a href="/members/arikd398"&gt;arikd398&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
I am already aware of the point mentioned in &lt;a href="/members/ravalik"&gt;ravalik&lt;/a&gt;  comment.&lt;br /&gt;
However, I am curious to know how was @paragk998 able to create 2 primary keys in a data type.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56780?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 10:12:09 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f5a6f366-2272-4e31-a6f2-c9c693232d64</guid><dc:creator>arikd398</dc:creator><description>Hi  ,&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
As an alternative solution as suggested by Ravalik,&lt;br /&gt;
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.&lt;br /&gt;
From DB side Additional Column should be Unique Key, PK is ( Primary Key1 and Primary Key2)&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56775?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 09:41:16 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:6c0bd2f7-7eab-4536-9769-94b477cab8fd</guid><dc:creator>komalc3</dc:creator><description>&lt;p&gt;PFB the xsd:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;lt;xsd:schema xmlns:xsd=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot; xmlns:tns=&amp;quot;urn:com:appian:types:MYAPP&amp;quot; targetNamespace=&amp;quot;urn:com:appian:types:MYAPP&amp;quot;&amp;gt;
  &amp;lt;xsd:complexType name=&amp;quot;MYAPP_Security&amp;quot;&amp;gt;
    &amp;lt;xsd:annotation&amp;gt;
      &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;
        @Table(name=&amp;quot;MYAPP_SECURITY&amp;quot;)
	  &amp;lt;/xsd:appinfo&amp;gt;
    &amp;lt;/xsd:annotation&amp;gt;
    &amp;lt;xsd:sequence&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;id&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:int&amp;quot;&amp;gt;
        &amp;lt;xsd:annotation&amp;gt;
          &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id&amp;lt;/xsd:appinfo&amp;gt;
        &amp;lt;/xsd:annotation&amp;gt;
      &amp;lt;/xsd:element&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;firstName&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:string&amp;quot;&amp;gt;
        &amp;lt;xsd:annotation&amp;gt;
          &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Id @Column(length=255)&amp;lt;/xsd:appinfo&amp;gt;
        &amp;lt;/xsd:annotation&amp;gt;
      &amp;lt;/xsd:element&amp;gt;
      &amp;lt;xsd:element name=&amp;quot;lastName&amp;quot; nillable=&amp;quot;true&amp;quot; type=&amp;quot;xsd:string&amp;quot;&amp;gt;
        &amp;lt;xsd:annotation&amp;gt;
          &amp;lt;xsd:appinfo source=&amp;quot;appian.jpa&amp;quot;&amp;gt;@Column(length=255)&amp;lt;/xsd:appinfo&amp;gt;
        &amp;lt;/xsd:annotation&amp;gt;
      &amp;lt;/xsd:element&amp;gt;
    &amp;lt;/xsd:sequence&amp;gt;
  &amp;lt;/xsd:complexType&amp;gt;
&amp;lt;/xsd:schema&amp;gt;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Screen shot of Table structure:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1529314896169v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1529314896169v1.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56774?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 09:33:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e3828f2a-38a8-435e-b6ed-30900c4d8da8</guid><dc:creator>PhilB</dc:creator><description>&lt;p&gt;Composite keys are, in effect, not supported. The options for dealing with composite keys are documented here: &lt;a href="https://docs.appian.com/suite/help/18.2/Database_Schema_Best_Practices.html#composite-keys"&gt;docs.appian.com/.../Database_Schema_Best_Practices.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56773?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 09:33:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:5f4aa213-8955-4a9d-9e22-b2355ecb7c74</guid><dc:creator>paragk998</dc:creator><description>check your xsd&lt;br /&gt;
&lt;br /&gt;
&amp;quot;MYAPPSecurity_DT1&amp;quot;&lt;br /&gt;
this column may be having different data type in xsd and table&lt;br /&gt;
&lt;br /&gt;
I guess you took this as &amp;quot;Date&amp;quot; in DB and &amp;quot;string in XSD&amp;quot;&lt;br /&gt;
&lt;br /&gt;
it will be good if you can share your XSD.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56770?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 09:14:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e2470d3a-3fa2-4963-8c47-9ebe2347f11d</guid><dc:creator>komalc3</dc:creator><description>&lt;p&gt;Hi paragk998&lt;/p&gt;
&lt;p&gt;Thanx for replying!!&lt;/p&gt;
&lt;p&gt;What I am trying to do is: I am&amp;nbsp;modifying my existing CDT and uploading a new version of it wherein I want to make&amp;nbsp;another existing column&amp;nbsp;as primary key.&lt;/p&gt;
&lt;p&gt;The screen shot of table is (which is correct):&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1529313030211v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1529313030211v1.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Below is the screen shot with the error which I get when I try to upload new version of my CDT wherein I am making an existing column primary key with @Id annotation&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1529313176129v2.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1529313176129v2.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Am I missing anything, any suggestion...?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56756?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 07:15:08 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dab4fce4-3005-4ade-b2bf-b8570cae16c1</guid><dc:creator>paragk998</dc:creator><description>&lt;p&gt;Hi komalc&lt;/p&gt;
&lt;p&gt;in that case create CDT from xsd. or database table&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1529305997895v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1529305997895v1.png" alt=" " /&gt;&lt;/a&gt; &lt;br /&gt;hope this will help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56748?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 06:08:11 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:eaa81f42-cdbd-4cb5-97ea-876b181b0f1a</guid><dc:creator>komalc3</dc:creator><description>Hi &lt;a href="/members/ravalik"&gt;ravalik&lt;/a&gt; &lt;br /&gt;
&lt;br /&gt;
I am aware of the design practice!!&lt;br /&gt;
But I am asking this question out of curiosity as I feel this is a limitation that we can have only one column as primary key in CDT be it an additional column which is a combination of two columns or a column in itself.&lt;br /&gt;
&lt;br /&gt;
Also any idea about in which scenario do I get &amp;quot;Unique Key Constraint violated error&amp;quot;.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56747?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 06:01:32 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:d28d8a34-911c-420a-816c-e6bc33df7476</guid><dc:creator>ravalik</dc:creator><description>Hi komalc,&lt;br /&gt;
&lt;br /&gt;
The constraints occur in the following cases:&lt;br /&gt;
Databases can enforce constraints on column values that are not enforced by Appian on CDT field values.&lt;br /&gt;
&lt;br /&gt;
For example, a database may require a column value to be &amp;quot;not null&amp;quot;, but the field in Appian can be empty. Be aware of these differences when designing your data stores.&lt;br /&gt;
&lt;br /&gt;
Use the attribute nillable=&amp;quot;true&amp;quot; to prevent columns in your data store from enforcing a &amp;quot;non-null&amp;quot; constraint.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can create additional column to save combination values of (Value 1) and (value 2) Make that additional column as PK in your CDT.&lt;br /&gt;
From DB side Additional Column should be Unique Key, PK is (value 1 and value 2)&lt;br /&gt;
&lt;br /&gt;
For more info , please have a look on &lt;a href="https://docs.appian.com/suite/help/18.2/Database_Schema_Best_Practices.html#composite-keys."&gt;docs.appian.com/.../Database_Schema_Best_Practices.html&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
ravalik&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56746?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 05:48:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:830b2f10-abf8-44e7-acc0-29be8a071056</guid><dc:creator>komalc3</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;a href="/members/paragk998"&gt;paragk998&lt;/a&gt;&amp;nbsp;&lt;br /&gt; &lt;br /&gt; Thanx for replying!!&lt;br /&gt; My scenario&amp;nbsp;requires that I need to make a composite key the primary key i.e. need to make two columns as primary key.&lt;/p&gt;
&lt;p&gt;Also when I open the&amp;nbsp;data type, Appian allows to create only one column as primary key though in XSD (using @Id annotation) as well as in the MySQL table structure we can add two columns as primary key (as shown below).&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/11/pastedimage1529301627596v1.png"&gt;&lt;img src="/resized-image/__size/320x240/__key/communityserver-discussions-components-files/11/pastedimage1529301627596v1.png" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Any suggestions...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Query around Primary Key in Appian My SQL Database</title><link>https://community.appian.com/thread/56745?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 05:27:06 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e81515e9-20e5-4591-ad8c-c95390ec6dda</guid><dc:creator>paragk998</dc:creator><description>hi&lt;br /&gt;
if you are sure that the 2 column will make unique combination. then no need to declare primary key.&lt;br /&gt;
in database table only one column can be primary key (if you define).&lt;br /&gt;
&lt;br /&gt;
instead, just declare column as other columns&lt;br /&gt;
and at the time of query use 2 filters combination with AND.&lt;br /&gt;
&lt;br /&gt;
if you declare primary key that means its values must be unique otherwise you will get error.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>