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

Separate creating the DB schema from the engine creation #84

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

chrisburr
Copy link
Member

When running in production we don't want to be filling the DB schema everytime the engine is created.

This PR:

  • Adds a new classmethod available_implementations to BaseDB that retrieves available implementations for a given database name.
  • Adds a __main__ module to diracx.db such that the databases can be initialised with something like python -m diracx.db init-sql



def parse_args():
parser = argparse.ArgumentParser()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth adding a parameter to specify a DB already

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the moment it's implicitly done by controlling which environment variables are set. As we know we want to use something like Alembic I wasn't sure it was worth making this more complex until we know how best to integrate it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hesitating yesterday before writing the comment exactly because of Alambic. However, it does mean that before we support for real the first endpoints (i.e. we can run a given functionality with diracx only, we need to have Alambic strategy sorted out). I am fine with this though, but we should have it on the road map

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought Alambic was already on the roadmap.

it does mean that before we support for real the first endpoints (i.e. we can run a given functionality with diracx only, we need to have Alambic strategy sorted out)

Why is this the case?

Copy link
Contributor

@chaen chaen Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought Alambic was already on the roadmap.

Of course it is, the questions is just where to place it :-)

Why is this the case?

Because if we start with an alternative handcooked solution, we take the usual risk of not investing the effort of doing things properly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how adding a CLI parameter to specify the DB makes the sitution any better. It just makes it more likely it gets push off to "later".

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is exactly my point :-) So we agree, it just means that we need to start looking at Alambic earlier than I had though

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed #88

@chaen chaen merged commit 922bfec into DIRACGrid:main Sep 14, 2023
5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants