Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find datasets without passing product argument #1426

Open
sotosoul opened this issue Mar 24, 2023 · 1 comment
Open

Find datasets without passing product argument #1426

sotosoul opened this issue Mar 24, 2023 · 1 comment
Labels

Comments

@sotosoul
Copy link

sotosoul commented Mar 24, 2023

Expected behaviour

Not sure if this is an expected behaviour but I'd assume I could query for a specific date range or other metadata without specifying which product.

find_datasets will not work without specifying a product.

Actual behaviour

The actual behaviour is a ValueError saying "must specify a product".

Temporary workaround

Removing the if not query.product statement allows for returning results without the product name. The following change would also work in my case, even better so, since will will allow searching by product_family:

def find_datasets_lazy(self, limit=None, ensure_location=False, dataset_predicate=None, **kwargs):

        query = Query(self.index, **kwargs)
        if query.product or query.search['product_family']:  # or query.product_family if it can be integrated into the Query class
            <do the search>
        else:
            raise ValueError("must specify a product or product_family")
        return datasets

Environment information

Datacube version: 1.8.12

@SpacemanPaul
Copy link
Contributor

SpacemanPaul commented Mar 29, 2023

Unfortunately the existing architecture of the index/database layer makes this more complicated than it appears on the surface. A major overhaul of the index/database layer is currently underway that will make use cases like this much easier to address. The fruits of this overhaul will appear in future 1.9.x and 2.0.x releases.

You can do cross-product searches using the lower level dc.index.datasets.search() method directly, but it is discouraged at the core API level because it is highly inefficient.

See also #542

@SpacemanPaul SpacemanPaul added the v2 label Jun 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants