# Clef error when searching for local data

**URL:** <https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992>\
**Category:** General\
**Tags:** nci, help, cmip6, hh5, clef\
**Created:** [12 December 2024 04:10 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992 "2024-12-12T04:10:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aukkola](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aukkola/32/202_2.png) [@aukkola](https://forum.access-hive.org.au/u/aukkola)\
**Post date:** [12 December 2024 04:10 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/1 "2024-12-12T04:10:57Z")

</div>

Hello,  
I’m encountering an error using Clef when searching for local CMIP6 data. E.g. this search returns the following error:

```auto
module use /g/data3/hh5/public/modules
module load conda/analysis3-unstable

clef --local cmip5 --model MPI-ESM-LR --variable tas --table day

```

```python
df = pd.read_sql(r.selectable, con=session.connection())
ERROR: Query must be a string unless using sqlalchemy.

```

The error goes away if I remove the “–local” flag but I then get search results that are not available on NCI and have to manually remove those. Any ideas on how to fix this would be welcome!

Thanks,  
Anna

---

<div class="post-metadata">

**Author:** ![Aidan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aidan/32/42_2.png) [@Aidan](https://forum.access-hive.org.au/u/Aidan)\
**Post date:** [12 December 2024 22:55 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/2 "2024-12-12T22:55:32Z")

</div>

Hi @aukkola

Just FYI Clef is no longer supported as CLEX is closing. @holger might still be available until the end of the year.

I suspect this might be a `pandas`/`sqalchemy` version issue. I saw a similar problem with a different project that required rewriting some code from

```python
pd.read_sql_query(qstring.format(namefield=name_sql ...)

```

to a form like so:

```python
pd.DataFrame(data=list(self.db.query(qstring.format(namefield, ..)

```

I’m not expecting you to re-write the code, but thought it worth noting in case someone else does.

For you it might work to use an older version of the `conda/analysis3` environment that has an older `pandas`/`sqlalchemy` combination.

---

<div class="post-metadata">

**Author:** ![aukkola](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aukkola/32/202_2.png) [@aukkola](https://forum.access-hive.org.au/u/aukkola)\
**Post date:** [12 December 2024 23:09 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/3 "2024-12-12T23:09:26Z")

</div>

Hi Aidan,

Thanks, that makes sense. Would you be able to advise how to access older conda versions?

I also understood that hh5 continues to be supported and Clef is one of the tools available under hh5. Is it only the hh5 python environment that will be looked after by ACCESS-NRI?

Thanks,  
Anna

---

<div class="post-metadata">

**Author:** ![Aidan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aidan/32/42_2.png) [@Aidan](https://forum.access-hive.org.au/u/Aidan)\
**Post date:** [13 December 2024 06:07 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/4 "2024-12-13T06:07:08Z")

</div>

> [@aukkola](#):
>
> Thanks, that makes sense. Would you be able to advise how to access older conda versions?

Sure. You can use `module avail` to see available versions:

```bash
$ module use /g/data/hh5/public/modules/
$ module avail conda/analysis
---------------------------------- /g/data/hh5/public/modules -----------------------------------
conda/analysis3-22.01 conda/analysis3-23.01 conda/analysis3-24.01                              
conda/analysis3-22.04 conda/analysis3-23.04 conda/analysis3-24.04(analysis:analysis3:default)  
conda/analysis3-22.07 conda/analysis3-23.07 conda/analysis3-24.07(analysis3-unstable)          
conda/analysis3-22.10 conda/analysis3-23.10 conda/analysis27-18.10(analysis27)           

```

So you could try `conda/analysis3-24.01`.

> [@aukkola](#):
>
> I also understood that hh5 continues to be supported and Clef is one of the tools available under hh5. Is it only the hh5 python environment that will be looked after by ACCESS-NRI?

The short answer is yes, though as always there are nuances. I can confidently say that Clef is not currently a supported tool, and as far as I know there are no plans for that to change.

If it is a valuable tool for the community it might be possible for the community of users to take over support and updates.

Otherwise there is a small window to ask @holger for help to fix the current bug.

---

<div class="post-metadata">

**Author:** ![Aidan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aidan/32/42_2.png) [@Aidan](https://forum.access-hive.org.au/u/Aidan)\
**Post date:** [17 December 2024 22:36 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/5 "2024-12-17T22:36:01Z")

</div>

> [@Aidan](#):
>
> So you could try `conda/analysis3-24.01`

Was that an effective work-around @aukkola?

---

<div class="post-metadata">

**Author:** ![aukkola](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aukkola/32/202_2.png) [@aukkola](https://forum.access-hive.org.au/u/aukkola)\
**Post date:** [14 January 2025 04:18 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/6 "2025-01-14T04:18:52Z")

</div>

Hi Aidan,

Thanks for the help and clarifying what’s happening with hh5. I finally got round to testing the Clef code again and yes it works when I load an older conda environment.

Cheers,  
Anna

---

<div class="post-metadata">

**Author:** ![Aidan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.access-hive.org.au/aidan/32/42_2.png) [@Aidan](https://forum.access-hive.org.au/u/Aidan)\
**Post date:** [16 January 2025 08:00 UTC](https://forum.access-hive.org.au/t/clef-error-when-searching-for-local-data/3992/7 "2025-01-16T08:00:21Z")

</div>


