Skip to content

add support for sqlmigrate #153

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

Merged
merged 2 commits into from
Oct 9, 2024
Merged

add support for sqlmigrate #153

merged 2 commits into from
Oct 9, 2024

Conversation

timgraham
Copy link
Collaborator

fixes #141

Copy link
Collaborator

@aclark4life aclark4life left a comment

Choose a reason for hiding this comment

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

Right! So the base wrapper got a get_database method that checks for queries_logged. Then various schema methods e.g. create_model call get_database which either returns a database connection or returns OperationDebugWrapper. In OperationDebugWrapper you determine whether you are logging migrations as they are executed or showing migrations prior to execution, via self.wrapped = self.collection if use_collection else self.db.database. LGTM, thanks!

@timgraham
Copy link
Collaborator Author

The last sentence isn't correct. OperationCollector is for collecting, while OperationDebugWrapper executes.

self.wrapped = self.collection if use_collection else self.db.database determines whether OperationCollector / OperationDebugWrapper is wrapping a database or a Collection.

@timgraham timgraham merged commit 2bd7459 into mongodb:main Oct 9, 2024
4 checks passed
@timgraham timgraham deleted the sqlmigrate branch October 9, 2024 14:29
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.

PYTHON-4802: add support for sqlmigrate
2 participants