Skip to content

[form_summary] Fails if there is more than 1 collection with the same name #40

@hellpe

Description

@hellpe

E.g. with Meyzieu (there was a sub-collection named "Meyzieu" in "Données confidentielles"):

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    import sys; from importlib import import_module; sys.argv = ['make_summary']; sys.exit(import_module('data_utils.form_summary.main').make_summary())
                                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/Users/laurent/Documents/Repos/data_utils/data_utils/form_summary/main.py", line 18, in make_summary
    collection_id = get_customer_collection_id(customer_collection_name)
  File "/Users/laurent/Documents/Repos/data_utils/data_utils/utils.py", line 102, in get_customer_collection_id
    return MTB.get_item_id('collection', name)
           ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/Users/laurent/Documents/Repos/data_utils/.venv/lib/python3.13/site-packages/metabase_api/_helper_methods.py", line 81, in get_item_id
    raise ValueError('There is more than one collection with the name "{}"'.format(item_name))
ValueError: There is more than one collection with the name "Meyzieu"

Workaround: be sure that there is no other collection with the client name
Possible fix: ask for the collection ID instead of the name

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions