<div dir="ltr">I did a quick test and it looks like pk can't be used as a field name:<div><br></div><div><div><a href="http://pulp_app.HelloWorld.pk" target="_blank">pulp_app.HelloWorld.pk</a>: (fields.E003) 'pk' is a reserved word that cannot be used as a field name.</div></div><div><br></div><div>This kind of leads me to believe that there are going to be certain field names that plugin writers simply cannot use and trying to ameliorate this situation isn’t going to work.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail-m_-5531220753644063883gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br></div><div>David<br></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On Fri, Jun 8, 2018 at 3:57 PM, Brian Bouterse <span dir="ltr"><<a href="mailto:bbouters@redhat.com" target="_blank">bbouters@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>@dalley: I agree we have practical reasons motivating the 3 field name changes, of which the most important is 'id' to '_id'. w.r.t using "<a href="http://object.pk" target="_blank">object.pk</a>", that could create similar problems. If a plugin writer defines a 'pk' field then core code using using '<a href="http://object.pk" target="_blank">object.pk</a>' will cause core code to receive their attribute and not the primary key. I think overall the strategy I think to minimize collisions we should use 'object._id' directly. How does that sound?<br></div><div><br></div><div>@jortel: We're blocked on your -1 vote expressed for 3704. We have practical plugin writer issues with the current state. Can you elaborate on why we shouldn't go forward with <a href="https://pulp.plan.io/issues/3704" target="_blank">https://pulp.plan.io/issues/37<wbr>04</a></div></div><div class="gmail-m_-5531220753644063883HOEnZb"><div class="gmail-m_-5531220753644063883h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 7, 2018 at 1:52 PM, Daniel Alley <span dir="ltr"><<a href="mailto:dalley@redhat.com" target="_blank">dalley@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><span><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">The article[1] you mentioned states that 'ID' <i>should</i> be used
    for the PK</blockquote><div><br></div></span><div>It does say this, but it says that the reasons for doing that are because id is "short, simple, and unambiguous", and that the reason you shouldn't prefix is because "the extra prefix is redundant".  I think it's really good advice for the general case, but the reasoning is based in practicality and not strong convention, and in our case we do have some other practical reasons to not do this. <br></div><div><br></div><div>I don't feel super strongly in either direction at this point.  I think my personal preference is to change "id" to something else, and use a convention of "<a href="http://object.pk" target="_blank">object.pk</a>" instead of "<a href="http://object.id" target="_blank">object.id</a>".  The "pk" attribute maps to whatever the primary key if we use that, we don't need to care what the field is called.</div><div><br></div><div>Re: Brian</div><span><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div>When encountered, what they expressed is "Why would Pulp reserve common 
field that I need to define on my subclass?" My feeling here is that we 
don't actually have a good reason.<br></div></blockquote><div><br></div></span><div>"id" is technically reserved (unless you override it) by Django, since it is the default PK field.  If they were to directly subclass `django.db.models.Model` they would have the same problem.  This is the only reason I'm a little conflicted, otherwise I be 100% in favor of changing it.<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="gmail-m_-5531220753644063883m_9108430154798433440h5">On Tue, May 29, 2018 at 12:46 PM, Jeff Ortel <span dir="ltr"><<a href="mailto:jortel@redhat.com" target="_blank">jortel@redhat.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_-5531220753644063883m_9108430154798433440h5">
  
    
  
  <div bgcolor="#FFFFFF"><span>
    On 05/29/2018 08:24 AM, Brian Bouterse wrote:<br>
    <blockquote type="cite">On
      Fri, May 25, 2018 at 7:39 PM, Dana Walker <span dir="ltr"><<a href="mailto:dawalker@redhat.com" target="_blank">dawalker@redhat.com</a>></span>
      wrote:<br>
      <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
        <div dir="ltr">I'm basically -1 for the reasons Jeff enumerated
          but if he is ok with this, I'm happy to go ahead with it.<br>
          <br>
          <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">[Jeff]:<span><br>
              <div>In classic relational modeling, using ID as the
                primary key is common practice.  Especially when ORMs
                are involved.  The "id" added by plugin writers is a
                natural key so naming it ID goes against convention.</div>
            </span></blockquote>
          <div><br>
          </div>
          <div>This is echoed here, for further reading (though perhaps
            this article is overly simplified for our needs) in the
            sections "Key Fields" and "Prefixes and Suffixes (are bad)":<br>
            <a href="https://launchbylunch.com/posts/2014/Feb/16/sql-naming-conventions/" target="_blank">https://launchbylunch.com/post<wbr>s/2014/Feb/16/sql-naming-conve<wbr>ntions/</a> 
            <br>
          </div>
        </div>
      </blockquote>
      <div><br>
      </div>
      <div>That is true, but this article also talks about avoiding
        reserved words as well. I think we're hearing 'id' is a commonly
        reserved word for content types being modeled by plugin writers.<br>
      </div>
      <div><br>
      </div>
    </blockquote>
    <br></span>
    The article[1] you mentioned states that 'ID' <i>should</i> be used
    for the PK which means it is inappropriate for natural key fields
    defined by plugin writers.  The reserved words caution in the
    article are DDL/DML reserved words "Ex: Avoid using words like <code>user</code>,
    <code>lock</code>, or <code>table</code>." not reserved by plugins.<br>
    <br>
    [1]
<a class="gmail-m_-5531220753644063883m_9108430154798433440m_-5364761922646731884m_2541678481051581732moz-txt-link-freetext" href="https://launchbylunch.com/posts/2014/Feb/16/sql-naming-conventions/#primary-keys" target="_blank">https://launchbylunch.com/post<wbr>s/2014/Feb/16/sql-naming-conve<wbr>ntions/#primary-keys</a><br>
  </div>

<br></div></div><span>______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a><br>
<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a><br>
<br></blockquote></div><br></div></div>