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

Ticckt 45, running almebic on startup #51

Closed

Conversation

nargis-sultani
Copy link
Contributor

It has been tested and both running alembic on startup and running alembic manually work.
On startup, "alembic upgrade head" is executed.

@nargis-sultani nargis-sultani linked an issue Nov 22, 2023 that may be closed by this pull request
@nargis-sultani
Copy link
Contributor Author

Also, all the alembic tests pass for me locally. Only this test fails for me:
tests/app/test_config.py::test_jwt_opts_valid_values
I didn't make any changes to the src/config.py file though.

@nargis-sultani
Copy link
Contributor Author

I figured why the alembic tests are failing. I am making the changes.

@lchen-2101
Copy link
Collaborator

quick note, we don't want to move the db_revisions folder under the src folder, that should be left where it is. you can move the update database method to into the app code, probably in the config.py file instead of within db_revisions section

Copy link

Coverage report

The coverage rate went from 84.93% to 84.32% ⬇️
The branch rate is 85%.

50% of new lines are covered.

Diff Coverage details (click to unfold)

src/main.py

50% of new lines are covered (82.92% of the complete file).
Missing lines: 25, 26, 27, 28, 29

Comment on lines +35 to +38
# Interpret the config file for Python logging.
# This line sets up loggers basically.
if config.config_file_name is not None:
fileConfig(config.config_file_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

why were these changed from above?

# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
Copy link
Collaborator

Choose a reason for hiding this comment

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

why remove this comment? this is a continuation from the previous line

config.set_main_option("sqlalchemy.url", INST_CONN)

# end specific SBL configuration
INST_DB_PATH = f"{INST_DB_USER}:{INST_DB_PWD}@{INST_DB_HOST}/{INST_DB_NAME}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

what's this new variable?

@lchen-2101
Copy link
Collaborator

Let's try cleaning this up a bit, looks like a lot more changes than there really is, making it harder to review, and it would be easy to miss the change from fileConfig(config.config_file_name, disable_existing_loggers=False) to fileConfig(config.config_file_name). Maybe start from a new branch if the changes shown in the diffs are more than what you intended the actual changes should be.

@nargis-sultani
Copy link
Contributor Author

@lchen-2101 I will clean up and create a new branch.

@nargis-sultani nargis-sultani deleted the features/45_running_alembic_on_app_startup branch December 1, 2023 00:08
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.

Running Alembic on App Startup
2 participants