Subscribe
Accepted Solution

problem with a filter

hey guys.

when trying to re-write a filter i have to do something similar but a bit else,

i encounter the following error while trying to save the filter's query:

Filter 'Filter luns for DS by name prefix in a specific volume' returned attributes does not contain all natural keys. Filter's returned attributes '[id, name, num_part]' , dictionary entry natural keys '[array.ip, name]'

i tried the containing query in a query builder in Toad and it returned data fine.

ideas?


SELECT

    storage.lun.name,

    storage.volume.id,

    SUBSTRING_INDEX(storage.lun.name,

    '${lun_name_prefix}',

    -1) AS num_part

FROM

    storage.volume,

    storage.lun

WHERE

   storage.lun.volume_id = storage.volume.id

    AND storage.lun.name LIKE '${lun_name_prefix}%'

ORDER by

    num_part desc

thanks!

solal.

Frequent Contributor

Re: problem with a filter

Hi Solal,

Try this:

SELECT

    storage.lun.name as 'name',

    storage.array.ip as 'array.ip',

    storage.volume.id,

    SUBSTRING_INDEX(storage.lun.name,

    '${lun_name_prefix}',

    -1) AS num_part

FROM

    storage.volume,

    storage.lun,

    storage.array

WHERE

    storage.lun.volume_id = storage.volume.id

    AND storage.lun.name LIKE '${lun_name_prefix}%'

    AND storage.array.id = storage.volume.array_id

ORDER by

    num_part desc

Re: problem with a filter

Hey Anil.

Thanks for that!

What was it? I understand the array.ip row was missing, right? I didn't write it coherently...

Why does it affect this query?

Thanks,

Soli.

Frequent Contributor

Re: problem with a filter

Hi Solal,

The filter should return all the natural keys for the object being filtered. It can return other attributes as well but it SHOULD return the natural keys at least.

For dictionary object volume, the natural keys are:

1. array(reference)

2. name

For a reference, you will have to return all the natural keys of that Object. In this case it is the array that is being referenced.

The only natural key in array is the IP, i.e. "array.ip".

Hope this helps

-Anil