# Reading one attribute from Multi-Range Subarrays

**URL:** <https://forum.tiledb.com/t/reading-one-attribute-from-multi-range-subarrays/224>\
**Category:** Uncategorized\
**Created:** [July 10, 2020, 11:58am UTC](https://forum.tiledb.com/t/reading-one-attribute-from-multi-range-subarrays/224 "2020-07-10T11:58:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![voss](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@voss](https://forum.tiledb.com/u/voss)\
**Post date:** [July 10, 2020, 11:58am UTC](https://forum.tiledb.com/t/reading-one-attribute-from-multi-range-subarrays/224/1 "2020-07-10T11:58:59Z")

</div>

I have an array with this array schema:

```
dom = tiledb.Domain(
        tiledb.Dim(name="variantkey", domain=(0, 2 ** 64 - 2), tile=2, dtype=np.uint64),
        tiledb.Dim(name="sample_idx", domain=(0, 9000), tile=2, dtype=np.uint64))
    schema = tiledb.ArraySchema(domain=dom, sparse=True,
                                attrs=(tiledb.Attr(name="GT", dtype=np.int8),
                                       tiledb.Attr(name="DP", dtype=np.int64),
                                       tiledb.Attr(name="GQ", dtype=np.float64),
                                       ))

```

I wrote in some data and now I want to read some out again, but I only want the values from one attribute

Usually, when I want all attributes I do:

```
with tiledb.SparseArray(uri, mode='r') as A:
         output = A.multi_index[list(variantkey), list(sample)]

```

My output looks something like this:

```
OrderedDict([('DP', array([51, 10, 10, 8])), ('GQ', array([2., 2., 1., 5.])), ('GT', array([-1, 1, 1, 1], dtype=int8)), ('sample_idx', array([1, 1, 1, 1], dtype=uint64)), ('variantkey', array([ 576460761042780160, 576460763192885248, 576460806544375808,
       12682136636723036160], dtype=uint64))])

```

What I want now is something like this:

```
OrderedDict([('DP', array([51, 10, 10, 8])), ('sample_idx', array([1, 1, 1, 1], dtype=uint64)), ('variantkey', array([ 576460761042780160, 576460763192885248, 576460806544375808,
       12682136636723036160], dtype=uint64))])

```

So basically the same but just for one attribute.  
Is this possible with multi-range subarrays?  
I tried to do it with the `query` method, but it does not seem to work.

If I try:

```
q = A.query(attrs="GT")
output = q.multi_index[list(variantkey), list(sample)]

```

I just get the same output as before with all three attributes.

---

<div class="post-metadata">

**Author:** ![voss](https://avatars.discourse-cdn.com/v4/letter/v/258eb7/32.png) [@voss](https://forum.tiledb.com/u/voss)\
**Post date:** [July 10, 2020, 1:11pm UTC](https://forum.tiledb.com/t/reading-one-attribute-from-multi-range-subarrays/224/2 "2020-07-10T13:11:31Z")

</div>

```
output = A.query(attrs=["GT]).multi_index[list(variantkey), list(sample)]

```

also does not work, I still get the same output

---

<div class="post-metadata">

**Author:** ![ihnorton](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.tiledb.com/ihnorton/32/23_2.png) [@ihnorton](https://forum.tiledb.com/u/ihnorton)\
**Post date:** [July 10, 2020, 1:35pm UTC](https://forum.tiledb.com/t/reading-one-attribute-from-multi-range-subarrays/224/3 "2020-07-10T13:35:27Z")

</div>

Hi @voss,

Could you please try the latest version, using `pip install --upgrade tiledb`. The version should be `0.6.4`.

Best,  
Isaiah
