intake / intake/intake

Bug in adding entries to catalog

Open
#520 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.1k
Forks
151
Avg merge
8h 24m
Merged PRs (30d)
2

Description

When taking an empty catalog:

```
metadata: {}
sources: {}
```

And running:

```
catalog = intake.open_catalog(catalog_uri) # catalog_uri points to empty catalog
source = intake.open_csv(csvfile)
exported_source = source.export(target_uri)
catalog.add(exported_source)
```

The code runs successfully. However, if we have a non-empty calendar such as:

```
metadata: {}
sources:
source1:
args:
meta: {}
urlpath: s3://dummy-bucket/dummy-uri
cache: []
catalog_dir: s3://dummy-bucket/dummy-uri-catalogues
description: ''
direct_access: forbid
driver: intake_parquet.source.ParquetSource
getenv: true
getshell: true
metadata: {}
name: source1
parameters: {}
```

The previous code breaks with `AttributeError: 'LocalCatalogEntry' object has no attribute '_yaml'` from L628 in file `intake/catalog/local.py`. I manage to fix it by changing that line to

`data['sources'][e] = list(entries[e].get()._yaml()['sources'].values())[0]`

But not sure if this will generalize well for all cases.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.