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

Make create_indexes independent #37

Open
gwbischof opened this issue Sep 17, 2020 · 3 comments
Open

Make create_indexes independent #37

gwbischof opened this issue Sep 17, 2020 · 3 comments
Assignees

Comments

@gwbischof
Copy link
Contributor

Databroker.v0 and this suitcase now have conflicting indexes due to this PR: #34
Where we decided to make resource uid unique. (Databroker.v0 also has code in it to create indexes.) This causes an exception when the index is created, if a conflicting index already exists. Which means that you can use this suitcase and databroker.v0 on the same database until it is fixed.

@jklynch and I think that we should make index creation independent of suitcase and databroker.
@danielballan suggested that we make the index creation independant, but we leave it in this package, and don't call it in the suitcase.init

@danielballan
Copy link
Member

@gwbischof summarized my view accurately above; to add a detail, tools like databroker-unpack will need access to this so they can seamlessly create/configure new databases, so it needs to stay in an importable package (as a opposed to be encoded in ansible).

A big +1 for separating this administrative activity from the reading and writing tools.

@danielballan
Copy link
Member

To outline practical steps here, in suitcase/mongo_normalized/__init__.py:

  1. Rename _create_indexes to create_indexes, a public method.
  2. Do not call create_indexes in __init__.

@danielballan
Copy link
Member

  1. Add a line to https://blueskyproject.io/databroker/how-to/mongo-backed-catalog.html which comes from https://github.com/bluesky/databroker/blob/main/docs/source/how-to/mongo-backed-catalog.rst along the lines:
python -c 'import suitcase.mongo_normalized; suitcase.mongo_normalized.Serializer("mongodb://...").create_indexes()'

@danielballan danielballan changed the title Make create_indexes independant Make create_indexes independent Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants