# How are the Collection Attribute Table and the Collection Object table linked?

**URL:** <https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017>\
**Category:** Get Help\
**Created:** [January 27, 2023, 5:11pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017 "2023-01-27T17:11:11Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leslie](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@Leslie](https://speciforum.org/u/Leslie)\
**Post date:** [January 27, 2023, 5:11pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/1 "2023-01-27T17:11:11Z")

</div>

We are trying to do some work behind the scenes on our data. We have some Boolian boxes that we fill in with a script because they are not fields that we can do batch edits on in the normal way. We have used the Boolian boxes in the Collection Object table to capture that data but would now like to transfer the data from those Boolian boxes to Boolian boxes in the Collection Object Attribute table. We have been able to see the table that seems to match these two tables (Attr perhaps?) but do not quite know how to work with it. We have information in the in the Collection Object Attribute table ( over 5000 lines) which makes sense as we have only recently started adding information to this table for a new project we are working on. These lines seem to a list of sequential numbers. However, when my IT person looks in the Attr table, it has nothing in it. Does it only make the match when you look at the collection object record or should we be seeing data in the Attr table. How would we script something to transfer the information we have in the Collection Object table to the Collection Object Attribute table? Any help appreciated. If it gets too esoteric, I will bring my IT person into the conversation. Thanks again.

---

<div class="post-metadata">

**Author:** ![AndyBentley](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/andybentley/32/534_2.png) [@AndyBentley](https://speciforum.org/u/AndyBentley)\
**Post date:** [January 27, 2023, 6:02pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/2 "2023-01-27T18:02:44Z")

</div>

@Leslie There are two tables listed in the scheme config for collection object attribute. I am not sure what the attr table does but it is not the table you need to populate with data. That is the Collection Object Attribute table

![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/8/8830f5ead190fec93d389c8ba9fb40b0553277ba.png)

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/c/c95ff430b92c17080ebf64adb4ec0e03dca6ff6b.png)

This table is linked to Collection Objects in a 1:1 relationship and contains a bunch of generic text and number fields that you use to populate the data you have. You could run scripts to transfer the data from the existing CO field to the COA field you want to use. Pay close attention to the properties (length, field type) of these fields so that you do not end up with data being cut off, etc.

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [January 27, 2023, 6:03pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/3 "2023-01-27T18:03:59Z")

</div>

Hi Leslie,

In addition to @AndyBentley’s comment, I have the following advice:

> We have used the Boolian boxes in the Collection Object table to capture that data but would now like to transfer the data from those Boolian boxes to Boolian boxes in the Collection Object Attribute table.

If you are doing behind-the-scenes work on the database, you would need to use SQL commands to create new Collection Object Attribute records (if they do not exist already), link them with the Collection Objects, and then you could use an `UPDATE` statement to set a boolean field in that table to `TRUE` when the Collection Object boolean field is `TRUE`. At that point, you could unset the boolean field in the Collection Object table and the process would be complete.

This is a bit of a complicated maneuver, especially if there are not existing CoA records associated with your CO records.

> (Attr perhaps?)  
> However, when my IT person looks in the Attr table, it has nothing in it.

The `CollectionObjectAttrs` relationship and table are not meant to be used at this time. You can however use the `CollectionObjectAttribute` relationship and table!

---

<div class="post-metadata">

**Author:** ![Leslie](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@Leslie](https://speciforum.org/u/Leslie)\
**Post date:** [January 27, 2023, 8:01pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/4 "2023-01-27T20:01:26Z")

</div>

Thanks Andy,

We are using the Collection Object Attribute table to house our data, but thought that the Attr table may have been some sort of connector. We are not using 7 yet and were not sure what was the key(?) that linked the two tables together.

–Leslie

---

<div class="post-metadata">

**Author:** ![Leslie](https://avatars.discourse-cdn.com/v4/letter/l/ba8739/32.png) [@Leslie](https://speciforum.org/u/Leslie)\
**Post date:** [January 27, 2023, 8:03pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/5 "2023-01-27T20:03:00Z")

</div>

Thanks Grant,

I am forwarding both yours and Andy’s answers to my IT person.

---

<div class="post-metadata">

**Author:** ![AndyBentley](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/andybentley/32/534_2.png) [@AndyBentley](https://speciforum.org/u/AndyBentley)\
**Post date:** [January 27, 2023, 8:16pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/6 "2023-01-27T20:16:20Z")

</div>

There should be a primary key in that table that would link them but given that this is a 1:1 relationship to collection objects you could just use the CO PK to link the COA to the CO I would think

---

<div class="post-metadata">

**Author:** ![Marion](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Marion](https://speciforum.org/u/Marion)\
**Post date:** [December 17, 2024, 11:02am UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/7 "2024-12-17T11:02:26Z")

</div>

Is it really a one-to-one relationship? Because in Specify 7 and also in the Specify shema, it is noted that it is a one-to-many relationship.

 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/b/b2b5d8ef058223b023730679e26c121bac285d7c.png)  
 ![image](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/9/924b50b4b610db6bfb37970f71c0a08a93edfcf8.png)

---

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [December 19, 2024, 3:34pm UTC](https://speciforum.org/t/how-are-the-collection-attribute-table-and-the-collection-object-table-linked/1017/8 "2024-12-19T15:34:38Z")

</div>

Hi @Marion–

Thank you for your question! This is a quirk of how the data model is designed.

The table `CollectionObject` in the Specify database has a field known as `CollectionObjectAttributeID` which captures the identifier for the `CollectionObjectAttribute` record linked to it. Theoretically, a single `CollectionObjectAttribute` could be linked to multiple `CollectionObject` records thanks to this database design.

This _technically_ gives `CollectionObjectAttribute` a one-to-many relationship _to_ `CollectionObject`, but each `CollectionObject` has a one-to-one relationship to `CollectionObjectAttribute`.

**TL;DR:** A single `CollectionObject` can only have one `CollectionObjectAttribute`
