src/Database/Factory.php
protected function extractPrimaryKey()
    {
        if (static::$factories[$this->table]['primary_key'] !== null) {
            return static::$factories[$this->table]['primary_key'];
        }

        if (preg_match('/^chado\./', $this->table)) {
            $schema = chado_get_schema(str_replace('chado.', '', $this->table));
            if ($schema) {
                if (isset($schema['primary key'])) {
                    return $schema['primary key'][0];
                } elseif (isset($schema['primary keys'])) {
                    return $schema['primary keys'][0];
                }
            }
        }

        throw new \Exception("Unable to determine primary key for $this->table factory. Please provide the primary key such as `nid` as a third argument in Factory::define().");
    }
protected function extractPrimaryKey()
    {
        if (static::$factories[$this->table]['primary_key'] !== null) {
            return static::$factories[$this->table]['primary_key'];
        }

        if (preg_match('/^chado\./', $this->table)) {
            $schema = chado_get_schema(str_replace('chado.', '', $this->table));
            if ($schema) {
                if (isset($schema['primary key'])) {
                    return $schema['primary key'][0];
                } elseif (isset($schema['primary keys'])) {
                    return $schema['primary keys'][0];
                }
            }
        }

        throw new \Exception("Unable to determine primary key for $this->table factory. Please provide the primary key such as `nid` as a third argument in Factory::define().");
    }
Get the primary key of a table.

@throws \Exception
@return string